Package net.sf.basedb.util
Class FileImportInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- net.sf.basedb.core.plugin.ImportInputStream
-
- net.sf.basedb.util.FileImportInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class FileImportInputStream extends ImportInputStream
An extension to theImportInputStream
class which reads from a file on the BASE file system.- Version:
- 2.9
- Author:
- nicklas
- Last modified
- $Date: 2010-05-27 10:54:05 +0200 (to, 27 maj 2010) $
-
-
Constructor Summary
Constructors Constructor Description FileImportInputStream(File file, long offset, String charset)
Create a new import stream that reads data from a file in the BASE filesystem.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCharacterSet()
CallsFile.getCharacterSet()
, unless a character set was specified in the constructor.String
getFilename()
CallsCommonItem.getName()
.long
getLength()
CallsFile.getSize()
to get the file size.String
getMimeType()
CallsFile.getMimeType()
.-
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, transferTo
-
-
-
-
Constructor Detail
-
FileImportInputStream
public FileImportInputStream(File file, long offset, String charset)
Create a new import stream that reads data from a file in the BASE filesystem.- Parameters:
file
- The file to read fromoffset
- The offset (in bytes) to start reading fromcharset
- The character set to use when reading the file, or null to useFile.getCharacterSet()
.
-
-
Method Detail
-
getLength
public long getLength()
CallsFile.getSize()
to get the file size.- Overrides:
getLength
in classImportInputStream
- Returns:
- The number of bytes, or -1 if not known
-
getMimeType
public String getMimeType()
CallsFile.getMimeType()
.- Overrides:
getMimeType
in classImportInputStream
- Returns:
- The MIME type of null if not known
-
getCharacterSet
public String getCharacterSet()
CallsFile.getCharacterSet()
, unless a character set was specified in the constructor.- Overrides:
getCharacterSet
in classImportInputStream
- Returns:
- The character set, or null if not known
- See Also:
Charset.forName(String)
-
getFilename
public String getFilename()
CallsCommonItem.getName()
.- Overrides:
getFilename
in classImportInputStream
- Returns:
- The name, or null if not known
-
-