2.17.2: 2011-06-17

net.sf.basedb.util
Class FileImportInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by net.sf.basedb.core.plugin.ImportInputStream
              extended by net.sf.basedb.util.FileImportInputStream
All Implemented Interfaces:
Closeable

public class FileImportInputStream
extends ImportInputStream

An extension to the ImportInputStream 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 (Thu, 27 May 2010) $

Field Summary
private  String charset
           
private  File file
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
FileImportInputStream(File file, long offset, String charset)
          Create a new import stream that reads data from a file in the BASE filesystem.
 
Method Summary
 String getCharacterSet()
          Calls File.getCharacterSet(), unless a character set was specified in the constructor.
 String getFilename()
          Calls CommonItem.getName().
 long getLength()
          Calls File.getSize() to get the file size.
 String getMimeType()
          Calls File.getMimeType().
 
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
 

Field Detail

file

private final File file

charset

private final String charset
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 from
offset - The offset (in bytes) to start reading from
charset - The character set to use when reading the file, or null to use File.getCharacterSet().
Method Detail

getLength

public long getLength()
Calls File.getSize() to get the file size.

Overrides:
getLength in class ImportInputStream
Returns:
The number of bytes, or -1 if not known

getMimeType

public String getMimeType()
Calls File.getMimeType().

Overrides:
getMimeType in class ImportInputStream
Returns:
The MIME type of null if not known

getCharacterSet

public String getCharacterSet()
Calls File.getCharacterSet(), unless a character set was specified in the constructor.

Overrides:
getCharacterSet in class ImportInputStream
Returns:
The character set, or null if not known
See Also:
Charset.forName(String)

getFilename

public String getFilename()
Calls CommonItem.getName().

Overrides:
getFilename in class ImportInputStream
Returns:
The name, or null if not known

2.17.2: 2011-06-17