- 
- All Known Implementing Classes:
 ARFFDataFormat,AvroFormat,BinaryFormat,DelimitedTextFormat,FixedTextFormat,JSONFormat,LogDataFormat,MDFFormat,ORCFormat,ParquetFormat
public interface DataFormatDescribes the record format of external data, such as in a file. ADataFormatobject provides the necessary information for reading and writing external data, converting it to and from records in a dataflow graph.Many formats are predefined in the library; an implementation is only required if a new format needs to be defined. Normally, it is not necessary to work directly with formats. Instead, operators are provided which hide the
DataFormatobject and present a view more appropriate to the specific format. Examples of this technique are theReadDelimitedTextandWriteDelimitedTextoperators.- See Also:
 ReadSource,WriteSink
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceDataFormat.DataFormatterA formatter for converting record data to binary or text format.static interfaceDataFormat.DataParserA parser for record data in binary or text format. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DataFormat.DataParsercreateParser(ParsingOptions options)Create a new parser for the format using the specified parsing options.DataFormat.DataFormattercreateWriter(FormattingOptions options)Create a new writer for the format using the specified formatting options.FileMetadatagetMetadata()Gets the metadata associated with the format.RecordTokenTypegetType()Gets the record type associated with the format.booleanisSplittable()Indicates if the format supports parsing of subsections of a file.FileMetadatareadMetadata(FileClient fileClient, ByteSource source)Reads the metadata associated with the format.voidsetMetadata(FileMetadata metadata)Sets the metadata associated with the format.voidwriteMetadata(FileMetadata metadata, FileClient fileClient, ByteSink target)Writes the provided metadata associated with the format. 
 - 
 
- 
- 
Method Detail
- 
getType
RecordTokenType getType()
Gets the record type associated with the format. Records produced by the associated parser or consumed by the associated formatter will be of this type.For many formats, this may be derived from a schema object describing the format layout.
- Returns:
 - the format's record type
 
 
- 
getMetadata
FileMetadata getMetadata()
Gets the metadata associated with the format. Records produces by the associated parser or consumed by the associated formatter will use this metadata.- Returns:
 - the format's metadata
 
 
- 
setMetadata
void setMetadata(FileMetadata metadata)
Sets the metadata associated with the format. 
- 
readMetadata
FileMetadata readMetadata(FileClient fileClient, ByteSource source)
Reads the metadata associated with the format.- Parameters:
 fileClient- client used to read filesource- location of the files
 
- 
writeMetadata
void writeMetadata(FileMetadata metadata, FileClient fileClient, ByteSink target)
Writes the provided metadata associated with the format.- Parameters:
 metadata- the metadata to writefileClient- client used to write filesource- location of the files
 
- 
createParser
DataFormat.DataParser createParser(ParsingOptions options)
Create a new parser for the format using the specified parsing options.- Parameters:
 options- parsing options to use- Returns:
 - a new parser for reading external data
 
 
- 
createWriter
DataFormat.DataFormatter createWriter(FormattingOptions options)
Create a new writer for the format using the specified formatting options.- Parameters:
 options- formatting options to use- Returns:
 - a new formatter for writing external data
 
 
- 
isSplittable
boolean isSplittable()
Indicates if the format supports parsing of subsections of a file.A format should only return
trueif it can, at least in some situations, support this sort of parsing. If a format requires reading the entire file, it must returnfalse.If a format is not splittable, a file in the format cannot be parsed in parallel; however, individual files can still be parsed independently in parallel, as when reading the contents of a directory or using a file globbing pattern.
- Returns:
 trueif the format supports parsing only a portion of the file,falseotherwise
 
 - 
 
 -