Class ImportInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.sf.basedb.core.plugin.ImportInputStream
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
FileImportInputStream

public class ImportInputStream
extends FilterInputStream
An input stream used for input to import plug-ins. The input stream is a regular InputStream but provides methods for accessing metadata about the original source the stream is originating from.

This class is intended to be subclassed by implementations more suitable for the type of import. For example the FileImportInputStream for importing from files on the BASE file system.

Version:
2.9
Author:
nicklas
Last modified
$Date: 2008-09-16 08:31:13 +0200 (ti, 16 sep 2008) $
  • Constructor Details

    • ImportInputStream

      public ImportInputStream​(InputStream in)
      Create a new import stream.
      Parameters:
      in - The source stream to read from
  • Method Details

    • getLength

      public long getLength()
      Get the length of the stream in number of bytes. The default implementation returns -1.
      Returns:
      The number of bytes, or -1 if not known
    • getMimeType

      public String getMimeType()
      Get the MIME type of the source.
      Returns:
      The MIME type of null if not known
    • getCharacterSet

      public String getCharacterSet()
      Get the character set used by the source if it is a text-file.
      Returns:
      The character set, or null if not known
      See Also:
      Charset.forName(String)
    • getFilename

      public String getFilename()
      Get the name of the source.
      Returns:
      The name, or null if not known