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
public class ExportOutputStream extends OutputStream
An output stream used for immediate download from export plugins. The plugin must implement theImmediateDownloadExporter
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 theFileExportOutputStream
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
Fields Modifier and Type Field Description private OutputStream
out
-
Constructor Summary
Constructors Constructor Description ExportOutputStream(OutputStream out)
Create a new export stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
File
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 Detail
-
out
private final OutputStream out
-
-
Constructor Detail
-
ExportOutputStream
public ExportOutputStream(OutputStream out)
Create a new export stream.- Parameters:
out
- The underlying stream to write the exported data to- Throws:
NullPointerException
- If out is null
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
setContentLength
public void setContentLength(long contentLength)
Do nothing. Should be overridden by subclasses.
-
setMimeType
public void setMimeType(String mimeType)
Do nothing. Should be overridden by subclasses.
-
setCharacterSet
public void setCharacterSet(String charset)
Do nothing should be overridden by subclasses.- Since:
- 2.9
-
setFilename
public void setFilename(String name)
Do nothing. Should be overridden by subclasses.
-
-