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,PropertyFile
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
ConstructorsConstructorDescriptionFileSource(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 TypeMethodDescriptionvoidbytesRead(long bytes) static FileSourcecreateFileSource(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) booleanlonglength()Returns the total number of bytes of this stream.voidtoURL()Methods inherited from class de.grogra.pf.io.FilterSourceBase
getFilter, getFlavor, getMetaData, getRegistry, initProgressMonitor, setMetaData, setProgress, setProgress0, setProgressImpl, toString, useAutoProgressMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.grogra.pf.io.FilterSource
getFilter, getFlavor, getMetaData, initProgressMonitor, setMetaData, setProgressMethods 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:VirtualFileReaderSourceReturns the file system in which the file is contained.- Specified by:
getFileSystemin interfaceVirtualFileReaderSource- Returns:
- file system
-
getFile
Description copied from interface:VirtualFileReaderSourceReturns the file from which the data can be obtained.- Specified by:
getFilein interfaceVirtualFileReaderSource- Returns:
- file representing the data
-
getSystemId
Description copied from interface:FilterSourceReturns a system id which identifies this source.- Specified by:
getSystemIdin interfaceFilterSource- Returns:
- system id
-
isReadOnly
public boolean isReadOnly() -
getInputStream
Description copied from interface:InputStreamSourceReturns a stream to obtain the data as a stream of bytes.- Specified by:
getInputStreamin interfaceInputStreamSource- Returns:
- an input stream for the data
- Throws:
IOException
-
length
public long length()Description copied from interface:InputStreamSourceReturns the total number of bytes of this stream. A negative values indicates that this number is unknown.- Specified by:
lengthin interfaceInputStreamSource- Returns:
- number of bytes
-
bytesRead
public void bytesRead(long bytes) - Specified by:
bytesReadin interfaceCountingInputStream.Monitor
-
streamClosed
public void streamClosed()- Specified by:
streamClosedin interfaceCountingInputStream.Monitor
-
getOutputStream
- Throws:
IOException
-
getWriter
- Throws:
IOException
-
getReader
Description copied from interface:ReaderSourceReturns a reader to obtain the data as a stream of characters.- Specified by:
getReaderin 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:FileReaderSourceReturns the file from which the data can be obtained.- Specified by:
getInputFilein interfaceFileReaderSource- Returns:
- file representing the data
-
readContent
- Throws:
IOException
-
toURL
-
createFileSource
public static FileSource createFileSource(String systemId, MimeType mimeType, RegistryContext ctx, ModifiableMap metaData)
-