2.17.2: 2011-06-17

net.sf.basedb.core.plugin
Class ImportInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by net.sf.basedb.core.plugin.ImportInputStream
All Implemented Interfaces:
Closeable
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 (Tue, 16 Sep 2008) $

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
ImportInputStream(InputStream in)
          Create a new import stream.
 
Method Summary
 String getCharacterSet()
          Get the character set used by the source if it is a text-file.
 String getFilename()
          Get the name of the source.
 long getLength()
          Get the length of the stream in number of bytes.
 String getMimeType()
          Get the MIME type of the source.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportInputStream

public ImportInputStream(InputStream in)
Create a new import stream.

Parameters:
in - The source stream to read from
Method Detail

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

2.17.2: 2011-06-17