de.grogra.pf.io
Class FileSource
java.lang.Object
de.grogra.pf.io.FilterSourceBase
de.grogra.pf.io.FileSource
- All Implemented Interfaces:
- FileReaderSource, FilterSource, InputStreamSource, ReaderSource, VirtualFileReaderSource, RegistryContext, CountingInputStream.Monitor
public class FileSource
- extends FilterSourceBase
- implements InputStreamSource, ReaderSource, FileReaderSource, VirtualFileReaderSource, CountingInputStream.Monitor
Constructor Summary |
FileSource(java.io.File file,
MimeType mimeType,
Registry reg,
ModifiableMap metaData)
|
FileSource(FileSystem fs,
java.lang.Object file,
RegistryContext reg,
ModifiableMap metaData)
|
FileSource(FileSystem fs,
java.lang.Object file,
java.lang.String systemId,
MimeType mimeType,
Registry reg,
ModifiableMap metaData)
|
Methods inherited from class de.grogra.pf.io.FilterSourceBase |
getFilter, getFlavor, getMetaData, getRegistry, initProgressMonitor, setMetaData, setProgress, setProgress0, setProgressImpl, toString, useAutoProgress |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FileSource
public FileSource(java.io.File file,
MimeType mimeType,
Registry reg,
ModifiableMap metaData)
FileSource
public FileSource(FileSystem fs,
java.lang.Object file,
RegistryContext reg,
ModifiableMap metaData)
FileSource
public FileSource(FileSystem fs,
java.lang.Object file,
java.lang.String systemId,
MimeType mimeType,
Registry reg,
ModifiableMap metaData)
bytesRead
public void bytesRead(long bytes)
- Specified by:
bytesRead
in interface CountingInputStream.Monitor
createFileSource
public static FileSource createFileSource(java.lang.String systemId,
MimeType mimeType,
RegistryContext ctx,
ModifiableMap metaData)
getFile
public java.lang.Object getFile()
- Description copied from interface:
VirtualFileReaderSource
- Returns the file from which the data can be obtained.
- Specified by:
getFile
in interface VirtualFileReaderSource
- Returns:
- file representing the data
getFileSystem
public FileSystem getFileSystem()
- Description copied from interface:
VirtualFileReaderSource
- Returns the file system in which the file is contained.
- Specified by:
getFileSystem
in interface VirtualFileReaderSource
- Returns:
- file system
getInputFile
public java.io.File getInputFile()
- Description copied from interface:
FileReaderSource
- Returns the file from which the data can be obtained.
- Specified by:
getInputFile
in interface FileReaderSource
- Returns:
- file representing the data
getInputStream
public java.io.InputStream getInputStream()
throws java.io.IOException
- Description copied from interface:
InputStreamSource
- Returns a stream to obtain the data as a stream of bytes.
- Specified by:
getInputStream
in interface InputStreamSource
- Returns:
- an input stream for the data
- Throws:
java.io.IOException
getOutputStream
public java.io.OutputStream getOutputStream(boolean append)
throws java.io.IOException
- Throws:
java.io.IOException
getReader
public java.io.Reader getReader()
throws java.io.IOException
- Description copied from interface:
ReaderSource
- Returns a reader to obtain the data as a stream of characters.
- Specified by:
getReader
in interface ReaderSource
- Returns:
- a reader for the data
- Throws:
java.io.IOException
getSystemId
public java.lang.String getSystemId()
- Description copied from interface:
FilterSource
- Returns a system id which identifies this source.
- Specified by:
getSystemId
in interface FilterSource
- Returns:
- system id
getWriter
public java.io.Writer getWriter(boolean append)
throws java.io.IOException
- Throws:
java.io.IOException
isReadOnly
public boolean isReadOnly()
length
public long length()
- Description copied from interface:
InputStreamSource
- Returns the total number of bytes of this stream. A negative values
indicates that this number is unknown.
- Specified by:
length
in interface InputStreamSource
- Returns:
- number of bytes
readContent
public java.lang.StringBuffer readContent()
throws java.io.IOException
- Throws:
java.io.IOException
streamClosed
public void streamClosed()
- Specified by:
streamClosed
in interface CountingInputStream.Monitor
toURL
public java.net.URL toURL()