2.17.2: 2011-06-17

net.sf.basedb.core.plugin
Class ExportOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by net.sf.basedb.core.plugin.ExportOutputStream
All Implemented Interfaces:
Closeable, Flushable
Direct Known Subclasses:
FileExportOutputStream, ServletExportOutputStream

public class ExportOutputStream
extends OutputStream

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 (Wed, 25 Feb 2009) $

Field Summary
private  OutputStream out
           
 
Constructor Summary
ExportOutputStream(OutputStream out)
          Create a new export stream.
 
Method Summary
 void close()
           
 void flush()
           
 File getFile()
          If the export stream is going to a BASE File 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.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
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.


getFile

public File getFile()
If the export stream is going to a BASE File 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

2.17.2: 2011-06-17