Top Description Fields Constructors Methods
tools.jackson.dataformat.csv.impl

public final Class CsvParserBootstrapper

extends Object
Class Inheritance
Imports
java.io.*, tools.jackson.core.*, tools.jackson.core.exc.JacksonIOException, tools.jackson.core.io.IOContext, .MergedStream, .UTF32Reader, tools.jackson.dataformat.csv.CsvParser, .CsvSchema

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

Modifier and TypeField and Description
protected boolean
protected int
protected final IOContext
protected final InputStream
protected final byte[]
private int
protected int
_inputProcessed

Current number of input units (bytes or chars) that were processed in previous blocks, before contents of current input buffer.

private int
pack-priv static final byte
pack-priv static final byte
pack-priv static final byte

Constructor Summary

AccessConstructor and Description
public
public
CsvParserBootstrapper(IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen)

Method Summary

Modifier and TypeMethod and Description
private static JacksonException
private Reader
_createReader(JsonEncoding enc, boolean autoClose)

private static JacksonException
private boolean
checkUTF16(int i16)

private boolean
checkUTF32(int quad)

public CsvParser
constructParser(ObjectReadContext readCtxt, int parserFeatures, int csvFeatures, CsvSchema schema)

protected boolean
ensureLoaded(int minimum)

private boolean

Returns:

True if a BOM was successfully found, and encoding thereby recognized.
handleBOM
(int quad)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_bigEndianback to summary
protected boolean _bigEndian
_bytesPerCharback to summary
protected int _bytesPerChar
_contextback to summary
protected final IOContext _context
_inback to summary
protected final InputStream _in
_inputBufferback to summary
protected final byte[] _inputBuffer
_inputEndback to summary
private int _inputEnd
_inputProcessedback to summary
protected int _inputProcessed

Current 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.

_inputPtrback to summary
private int _inputPtr
UTF8_BOM_1back to summary
pack-priv static final byte UTF8_BOM_1
UTF8_BOM_2back to summary
pack-priv static final byte UTF8_BOM_2
UTF8_BOM_3back to summary
pack-priv static final byte UTF8_BOM_3

Constructor Detail

CsvParserBootstrapperback to summary
public CsvParserBootstrapper(IOContext ctxt, InputStream in)
CsvParserBootstrapperback to summary
public CsvParserBootstrapper(IOContext ctxt, byte[] inputBuffer, int inputStart, int inputLen)

Method Detail

_createIOFailureback to summary
private static JacksonException _createIOFailure(String msg) throws JacksonException
_createReaderback to summary
private Reader _createReader(JsonEncoding enc, boolean autoClose) throws JacksonException
Annotations
@SuppressWarnings:resource
_wrapIOFailureback to summary
private static JacksonException _wrapIOFailure(IOException e) throws JacksonException
checkUTF16back to summary
private boolean checkUTF16(int i16)
checkUTF32back to summary
private boolean checkUTF32(int quad) throws JacksonException
constructParserback to summary
public CsvParser constructParser(ObjectReadContext readCtxt, int parserFeatures, int csvFeatures, CsvSchema schema) throws JacksonException
ensureLoadedback to summary
protected boolean ensureLoaded(int minimum) throws JacksonException
handleBOMback to summary
private boolean handleBOM(int quad) throws JacksonException
Returns:boolean

True if a BOM was successfully found, and encoding thereby recognized.

reportWeirdUCS4back to summary
private void reportWeirdUCS4(String type) throws JacksonException