Class CsvParserBootstrapper
java.lang.Object
tools.jackson.dataformat.csv.impl.CsvParserBootstrapper
This class is used to determine the encoding of byte stream
that is to contain CSV document.
Since there is no real specification for how this should work
with CSV, it will be based on rules used with JSON (which themselves
are similar to those used with XML); main points are to check for
BOM first, then look for multi-byted fixed-length encodings
(UTF-16, UTF-32). And finally, if neither found, must decide
between most likely alternatives, UTF-8 and Latin-1.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected intprotected final tools.jackson.core.io.IOContextprotected final InputStreamprotected final byte[]private intprotected intCurrent number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.private int(package private) static final byte(package private) static final byte(package private) static final byte -
Constructor Summary
ConstructorsConstructorDescriptionCsvParserBootstrapper(tools.jackson.core.io.IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen) CsvParserBootstrapper(tools.jackson.core.io.IOContext ctxt, InputStream in) -
Method Summary
Modifier and TypeMethodDescriptionprivate static tools.jackson.core.JacksonException_createIOFailure(String msg) private Reader_createReader(tools.jackson.core.JsonEncoding enc, boolean autoClose) private static tools.jackson.core.JacksonExceptionprivate booleancheckUTF16(int i16) private booleancheckUTF32(int quad) constructParser(tools.jackson.core.ObjectReadContext readCtxt, int parserFeatures, int csvFeatures, CsvSchema schema) protected booleanensureLoaded(int minimum) private booleanhandleBOM(int quad) private voidreportWeirdUCS4(String type)
-
Field Details
-
UTF8_BOM_1
static final byte UTF8_BOM_1- See Also:
-
UTF8_BOM_2
static final byte UTF8_BOM_2- See Also:
-
UTF8_BOM_3
static final byte UTF8_BOM_3- See Also:
-
_context
protected final tools.jackson.core.io.IOContext _context -
_in
-
_inputBuffer
protected final byte[] _inputBuffer -
_inputPtr
private int _inputPtr -
_inputEnd
private int _inputEnd -
_inputProcessed
protected int _inputProcessedCurrent number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.Note: includes possible BOMs, if those were part of the input.
-
_bigEndian
protected boolean _bigEndian -
_bytesPerChar
protected int _bytesPerChar
-
-
Constructor Details
-
CsvParserBootstrapper
-
CsvParserBootstrapper
public CsvParserBootstrapper(tools.jackson.core.io.IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen)
-
-
Method Details
-
constructParser
-
_createReader
private Reader _createReader(tools.jackson.core.JsonEncoding enc, boolean autoClose) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
handleBOM
private boolean handleBOM(int quad) throws tools.jackson.core.JacksonException - Returns:
- True if a BOM was successfully found, and encoding thereby recognized.
- Throws:
tools.jackson.core.JacksonException
-
checkUTF32
private boolean checkUTF32(int quad) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
checkUTF16
private boolean checkUTF16(int i16) -
reportWeirdUCS4
- Throws:
tools.jackson.core.JacksonException
-
ensureLoaded
protected boolean ensureLoaded(int minimum) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
_createIOFailure
private static tools.jackson.core.JacksonException _createIOFailure(String msg) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
_wrapIOFailure
private static tools.jackson.core.JacksonException _wrapIOFailure(IOException e) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-