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 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 Details

  • Constructor Details

    • 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 Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      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