Package net.sf.basedb.core.plugin
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) $
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
Constructors Constructor Description ImportInputStream(InputStream in)
Create a new import stream. -
Method Summary
Modifier and Type Method Description 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.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ImportInputStream
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
Get the MIME type of the source.- Returns:
- The MIME type of null if not known
-
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
Get the name of the source.- Returns:
- The name, or null if not known
-