java.lang.Object
de.grogra.pf.io.FilterSourceBase
de.grogra.pf.io.FileSource
- All Implemented Interfaces:
FileReaderSource
,FilterSource
,InputStreamSource
,ReaderSource
,VirtualFileReaderSource
,RegistryContext
,CountingInputStream.Monitor
- Direct Known Subclasses:
PreferencesFile
public class FileSource
extends FilterSourceBase
implements InputStreamSource, ReaderSource, FileReaderSource, VirtualFileReaderSource, CountingInputStream.Monitor
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.grogra.pf.io.FilterSource
FilterSource.MetaDataKey<V>
-
Field Summary
Fields inherited from interface de.grogra.pf.io.FilterSource
AUTO_PROGRESS, DESTINATION_FILE, DESTINATION_URL
-
Constructor Summary
ConstructorDescriptionFileSource
(FileSystem fs, Object file, RegistryContext reg, ModifiableMap metaData) FileSource
(FileSystem fs, Object file, String systemId, MimeType mimeType, Registry reg, ModifiableMap metaData) FileSource
(File file, MimeType mimeType, Registry reg, ModifiableMap metaData) -
Method Summary
Modifier and TypeMethodDescriptionvoid
bytesRead
(long bytes) static FileSource
createFileSource
(String systemId, MimeType mimeType, RegistryContext ctx, ModifiableMap metaData) getFile()
Returns the file from which the data can be obtained.Returns the file system in which the file is contained.Deprecated.The file should not get accessed casting it on a File object.Returns a stream to obtain the data as a stream of bytes.getOutputStream
(boolean append) Returns a reader to obtain the data as a stream of characters.Returns a system id which identifies this source.getWriter
(boolean append) boolean
long
length()
Returns the total number of bytes of this stream.void
toURL()
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
Methods inherited from interface de.grogra.pf.io.FilterSource
getFilter, getFlavor, getMetaData, initProgressMonitor, setMetaData, setProgress
Methods inherited from interface de.grogra.pf.registry.RegistryContext
getRegistry
-
Constructor Details
-
FileSource
public FileSource(FileSystem fs, Object file, String systemId, MimeType mimeType, Registry reg, ModifiableMap metaData) -
FileSource
-
FileSource
-
-
Method Details
-
getFileSystem
Description copied from interface:VirtualFileReaderSource
Returns the file system in which the file is contained.- Specified by:
getFileSystem
in interfaceVirtualFileReaderSource
- Returns:
- file system
-
getFile
Description copied from interface:VirtualFileReaderSource
Returns the file from which the data can be obtained.- Specified by:
getFile
in interfaceVirtualFileReaderSource
- Returns:
- file representing the data
-
getSystemId
Description copied from interface:FilterSource
Returns a system id which identifies this source.- Specified by:
getSystemId
in interfaceFilterSource
- Returns:
- system id
-
isReadOnly
public boolean isReadOnly() -
getInputStream
Description copied from interface:InputStreamSource
Returns a stream to obtain the data as a stream of bytes.- Specified by:
getInputStream
in interfaceInputStreamSource
- Returns:
- an input stream for the data
- Throws:
IOException
-
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 interfaceInputStreamSource
- Returns:
- number of bytes
-
bytesRead
public void bytesRead(long bytes) - Specified by:
bytesRead
in interfaceCountingInputStream.Monitor
-
streamClosed
public void streamClosed()- Specified by:
streamClosed
in interfaceCountingInputStream.Monitor
-
getOutputStream
- Throws:
IOException
-
getWriter
- Throws:
IOException
-
getReader
Description copied from interface:ReaderSource
Returns a reader to obtain the data as a stream of characters.- Specified by:
getReader
in interfaceReaderSource
- Returns:
- a reader for the data
- Throws:
IOException
-
getInputFile
Deprecated.The file should not get accessed casting it on a File object. GroIMP can load FileSource from virtual file, thus not compatible. Usually the getInputFile is used to create a FileReader wich make even less sense as is it more efficient to use getReader() which return the most optimized reader for reading this file in groimp.Description copied from interface:FileReaderSource
Returns the file from which the data can be obtained.- Specified by:
getInputFile
in interfaceFileReaderSource
- Returns:
- file representing the data
-
readContent
- Throws:
IOException
-
toURL
-
createFileSource
public static FileSource createFileSource(String systemId, MimeType mimeType, RegistryContext ctx, ModifiableMap metaData)
-