Class LocalFileSource
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.file.LocalFile
com.northconcepts.datapipeline.foundations.file.LocalFileSource
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,FileSource,Serializable
A
FileSource that reads a file on the local file system.- See Also:
-
Field Summary
Fields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDetects the file type from the file's extension or content, replacing any type already set.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element element) Opens a new stream to read the file's content; the caller must close it.setFileType(FileType fileType) Sets the file type, which is otherwise detected from the file's extension or content.Sets the name to the file name at the end of the path.Sets the path of the local file, clearing the cached file and detected file type.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class com.northconcepts.datapipeline.foundations.file.LocalFile
getContentType, getFile, getFileSize, getFileType, getName, getPath, getUrlPath, isLocal, toRecordMethods inherited from class com.northconcepts.datapipeline.foundations.core.Bean
addExceptionProperties, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties, exception, exception, exceptionMethods inherited from interface com.northconcepts.datapipeline.foundations.file.FileSource
getContentType, getFileSize, getFileType, getName, getPath, getUrlPath, isLocal
-
Constructor Details
-
LocalFileSource
public LocalFileSource()
-
-
Method Details
-
getInputStream
Description copied from interface:FileSourceOpens a new stream to read the file's content; the caller must close it.- Specified by:
getInputStreamin interfaceFileSource
-
setName
-
setPath
Description copied from class:LocalFileSets the path of the local file, clearing the cached file and detected file type. -
setNameFromPath
Description copied from class:LocalFileSets the name to the file name at the end of the path.- Overrides:
setNameFromPathin classLocalFile
-
setFileType
Description copied from class:LocalFileSets the file type, which is otherwise detected from the file's extension or content.- Overrides:
setFileTypein classLocalFile
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceFileSource- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classLocalFile- Parameters:
source-- Returns:
- this instance.
-
detectFileType
Description copied from class:LocalFileDetects the file type from the file's extension or content, replacing any type already set.- Overrides:
detectFileTypein classLocalFile
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException.- Specified by:
toXmlElementin interfaceXmlSerializable- Overrides:
toXmlElementin classLocalFile
-
fromXmlElement
- Specified by:
fromXmlElementin interfaceXmlSerializable- Overrides:
fromXmlElementin classLocalFile
-