Class TextLineInputFormat
- java.lang.Object
-
- org.apache.flink.connector.file.src.reader.SimpleStreamFormat<String>
-
- org.apache.flink.connector.file.src.reader.TextLineInputFormat
-
- All Implemented Interfaces:
Serializable
,ResultTypeQueryable<String>
,StreamFormat<String>
@PublicEvolving public class TextLineInputFormat extends SimpleStreamFormat<String>
A reader format that text lines from a file.The reader uses Java's built-in
InputStreamReader
to decode the byte stream using various supported charset encodings.This format does not support optimized recovery from checkpoints. On recovery, it will re-read and discard the number of lined that were processed before the last checkpoint. That is due to the fact that the offsets of lines in the file cannot be tracked through the charset decoders with their internal buffering of stream input and charset decoder state.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TextLineInputFormat.Reader
The actual reader for theTextLineInputFormat
.
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CHARSET_NAME
-
Fields inherited from interface org.apache.flink.connector.file.src.reader.StreamFormat
FETCH_IO_SIZE
-
-
Constructor Summary
Constructors Constructor Description TextLineInputFormat()
TextLineInputFormat(String charsetName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextLineInputFormat.Reader
createReader(Configuration config, FSDataInputStream stream)
Creates a new reader.TypeInformation<String>
getProducedType()
Gets the type produced by this format.-
Methods inherited from class org.apache.flink.connector.file.src.reader.SimpleStreamFormat
createReader, isSplittable, restoreReader
-
-
-
-
Field Detail
-
DEFAULT_CHARSET_NAME
public static final String DEFAULT_CHARSET_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TextLineInputFormat
public TextLineInputFormat()
-
TextLineInputFormat
public TextLineInputFormat(String charsetName)
-
-
Method Detail
-
createReader
public TextLineInputFormat.Reader createReader(Configuration config, FSDataInputStream stream) throws IOException
Description copied from class:SimpleStreamFormat
Creates a new reader. This method is called both for the creation of new reader (from the beginning of a file) and for restoring checkpointed readers.If the reader previously checkpointed an offset, then the input stream will be positioned to that particular offset. Readers checkpoint an offset by returning a value from the method
StreamFormat.Reader.getCheckpointedPosition()
method with an offset other thanCheckpointedPosition.NO_OFFSET
).- Specified by:
createReader
in classSimpleStreamFormat<String>
- Throws:
IOException
-
getProducedType
public TypeInformation<String> getProducedType()
Description copied from class:SimpleStreamFormat
Gets the type produced by this format. This type will be the type produced by the file source as a whole.- Specified by:
getProducedType
in interfaceResultTypeQueryable<String>
- Specified by:
getProducedType
in interfaceStreamFormat<String>
- Specified by:
getProducedType
in classSimpleStreamFormat<String>
- Returns:
- The data type produced by this function or input format.
-
-