Class LocalFileSink
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.file.LocalFile
com.northconcepts.datapipeline.foundations.file.LocalFileSink
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,FileSink,Serializable
A
FileSink that writes a file on the local file system, replacing or appending to its content.- 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 localFileSinkElement) Opens a new stream to write the file's content; the caller must close it.booleanisAppend()Indicates ifFileSink.getOutputStream()appends to an existing file instead of replacing it.setAppend(boolean append) Indicates if the output stream appends to an existing file instead of replacing it (default false).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.toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.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, isLocalMethods 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.FileSink
getContentType, getFileSize, getFileType, getName, getPath, getUrlPath, isLocal
-
Constructor Details
-
LocalFileSink
public LocalFileSink()
-
-
Method Details
-
getOutputStream
Description copied from interface:FileSinkOpens a new stream to write the file's content; the caller must close it.- Specified by:
getOutputStreamin interfaceFileSink
-
isAppend
public boolean isAppend()Description copied from interface:FileSinkIndicates ifFileSink.getOutputStream()appends to an existing file instead of replacing it. -
setAppend
Indicates if the output stream appends to an existing file instead of replacing it (default false). -
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
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin 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 interfaceFileSink- 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
-