Package net.sf.basedb.core.plugin
Class ExportOutputStream
java.lang.Object
java.io.OutputStream
net.sf.basedb.core.plugin.ExportOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
FileExportOutputStream
,ServletExportOutputStream
An output stream used for immediate download from export plugins. The plugin
must implement the
ImmediateDownloadExporter
interface. If the plugin
wants to set mime type, character set, content length and filename it must do
so before it starts writing data to the output stream.
This class is intended to be subclassed by implementations more
suitable for the type of download. For example the ServletExportOutputStream
implements direct download
from web clients and the FileExportOutputStream
implements
direct download to the BASE file system.
- Version:
- 2.2
- Author:
- nicklas
- Last modified
- $Date: 2009-02-25 10:55:44 +0100 (on, 25 feb 2009) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
flush()
getFile()
If the export stream is going to a BASEFile
object, use this method to access it.void
setCharacterSet
(String charset) Do nothing should be overridden by subclasses.void
setContentLength
(long contentLength) Do nothing.void
setFilename
(String name) Do nothing.void
setMimeType
(String mimeType) Do nothing.void
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
out
-
-
Constructor Details
-
ExportOutputStream
Create a new export stream.- Parameters:
out
- The underlying stream to write the exported data to- Throws:
NullPointerException
- If out is null
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
setContentLength
public void setContentLength(long contentLength) Do nothing. Should be overridden by subclasses. -
setMimeType
Do nothing. Should be overridden by subclasses. -
setCharacterSet
Do nothing should be overridden by subclasses.- Since:
- 2.9
-
setFilename
Do nothing. Should be overridden by subclasses. -
getFile
If the export stream is going to a BASEFile
object, use this method to access it. This class always return null, subclasses may override this method.- Returns:
- A File object or null
- Since:
- 2.11
-