com.fasterxml.jackson.dataformat.csv
Class CsvFactory

java.lang.Object
  extended by com.fasterxml.jackson.core.JsonFactory
      extended by com.fasterxml.jackson.dataformat.csv.CsvFactory
All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned

public class CsvFactory
extends com.fasterxml.jackson.core.JsonFactory


Nested Class Summary
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonFactory
com.fasterxml.jackson.core.JsonFactory.Feature
 
Field Summary
protected  char _cfgColumnSeparator
           
protected  char[] _cfgLineSeparator
           
protected  char _cfgQuoteCharacter
           
protected  int _csvGeneratorFeatures
           
protected  int _csvParserFeatures
           
protected static char[] DEFAULT_LF
           
static String FORMAT_NAME_CSV
          Name used to identify CSV format.
protected  Charset UTF8
           
 
Fields inherited from class com.fasterxml.jackson.core.JsonFactory
_characterEscapes, _factoryFeatures, _generatorFeatures, _inputDecorator, _objectCodec, _outputDecorator, _parserFeatures, _recyclerRef, _rootByteSymbols, _rootCharSymbols, DEFAULT_FACTORY_FEATURE_FLAGS, DEFAULT_GENERATOR_FEATURE_FLAGS, DEFAULT_PARSER_FEATURE_FLAGS, FORMAT_NAME_JSON
 
Constructor Summary
CsvFactory()
          Default constructor used to create factory instances.
CsvFactory(com.fasterxml.jackson.core.ObjectCodec oc)
           
 
Method Summary
protected  CsvGenerator _createJsonGenerator(com.fasterxml.jackson.core.io.IOContext ctxt, Writer out)
           
protected  com.fasterxml.jackson.core.JsonGenerator _createJsonGenerator(Writer out, com.fasterxml.jackson.core.io.IOContext ctxt)
          Overridable factory method that actually instantiates desired generator.
protected  CsvParser _createJsonParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt)
          Overridable factory method that actually instantiates desired parser.
protected  CsvParser _createJsonParser(InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt)
          Overridable factory method that actually instantiates desired parser.
protected  com.fasterxml.jackson.core.JsonParser _createJsonParser(Reader r, com.fasterxml.jackson.core.io.IOContext ctxt)
          Overridable factory method that actually instantiates desired parser.
protected  Reader _createReader(byte[] data, int offset, int len, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt)
           
protected  Reader _createReader(InputStream in, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt)
           
protected  Writer _createWriter(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc, com.fasterxml.jackson.core.io.IOContext ctxt)
           
 CsvFactory configure(CsvGenerator.Feature f, boolean state)
          Method for enabling or disabling specified generator feature (check CsvGenerator.Feature for list of features)
 CsvFactory configure(CsvParser.Feature f, boolean state)
          Method for enabling or disabling specified parser feature (check CsvParser.Feature for list of features)
 CsvGenerator createJsonGenerator(OutputStream out)
          Since Csv format always uses UTF-8 internally, no encoding need to be passed to this method.
 CsvGenerator createJsonGenerator(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc)
           note: co-variant return type
 CsvParser createJsonParser(byte[] data)
           
 CsvParser createJsonParser(byte[] data, int offset, int len)
           
 CsvParser createJsonParser(File f)
           
 CsvParser createJsonParser(InputStream in)
           
 CsvParser createJsonParser(URL url)
           
 CsvFactory disable(CsvGenerator.Feature f)
          Method for disabling specified generator feature (check CsvGenerator.Feature for list of features)
 CsvFactory disable(CsvParser.Feature f)
          Method for disabling specified parser features (check CsvParser.Feature for list of features)
 CsvFactory enable(CsvGenerator.Feature f)
          Method for enabling specified generator features (check CsvGenerator.Feature for list of features)
 CsvFactory enable(CsvParser.Feature f)
          Method for enabling specified parser feature (check CsvParser.Feature for list of features)
 String getFormatName()
           
 com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc)
          Sub-classes need to override this method (as of 1.8)
 boolean isEnabled(CsvGenerator.Feature f)
          Check whether specified generator feature is enabled.
 boolean isEnabled(CsvParser.Feature f)
          Checked whether specified parser feature is enabled.
 com.fasterxml.jackson.core.Version version()
           
 
Methods inherited from class com.fasterxml.jackson.core.JsonFactory
_createContext, _createUTF8JsonGenerator, _getBufferRecycler, _optimizedStreamFromURL, configure, configure, configure, createJsonGenerator, createJsonGenerator, createJsonParser, createJsonParser, disable, disable, disable, enable, enable, enable, getCharacterEscapes, getCodec, getInputDecorator, getOutputDecorator, hasJSONFormat, isEnabled, isEnabled, isEnabled, setCharacterEscapes, setCodec, setInputDecorator, setOutputDecorator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_NAME_CSV

public static final String FORMAT_NAME_CSV
Name used to identify CSV format. (and returned by getFormatName()

See Also:
Constant Field Values

DEFAULT_LF

protected static final char[] DEFAULT_LF

_csvParserFeatures

protected int _csvParserFeatures

_csvGeneratorFeatures

protected int _csvGeneratorFeatures

_cfgColumnSeparator

protected char _cfgColumnSeparator

_cfgQuoteCharacter

protected char _cfgQuoteCharacter

_cfgLineSeparator

protected char[] _cfgLineSeparator

UTF8

protected final Charset UTF8
Constructor Detail

CsvFactory

public CsvFactory()
Default constructor used to create factory instances. Creation of a factory instance is a light-weight operation, but it is still a good idea to reuse limited number of factory instances (and quite often just a single instance): factories are used as context for storing some reused processing objects (such as symbol tables parsers use) and this reuse only works within context of a single factory instance.


CsvFactory

public CsvFactory(com.fasterxml.jackson.core.ObjectCodec oc)
Method Detail

version

public com.fasterxml.jackson.core.Version version()
Specified by:
version in interface com.fasterxml.jackson.core.Versioned
Overrides:
version in class com.fasterxml.jackson.core.JsonFactory

getFormatName

public String getFormatName()
Overrides:
getFormatName in class com.fasterxml.jackson.core.JsonFactory

hasFormat

public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc)
                                                          throws IOException
Sub-classes need to override this method (as of 1.8)

Overrides:
hasFormat in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException

configure

public final CsvFactory configure(CsvParser.Feature f,
                                  boolean state)
Method for enabling or disabling specified parser feature (check CsvParser.Feature for list of features)


enable

public CsvFactory enable(CsvParser.Feature f)
Method for enabling specified parser feature (check CsvParser.Feature for list of features)


disable

public CsvFactory disable(CsvParser.Feature f)
Method for disabling specified parser features (check CsvParser.Feature for list of features)


isEnabled

public final boolean isEnabled(CsvParser.Feature f)
Checked whether specified parser feature is enabled.


configure

public final CsvFactory configure(CsvGenerator.Feature f,
                                  boolean state)
Method for enabling or disabling specified generator feature (check CsvGenerator.Feature for list of features)

Since:
1.2

enable

public CsvFactory enable(CsvGenerator.Feature f)
Method for enabling specified generator features (check CsvGenerator.Feature for list of features)


disable

public CsvFactory disable(CsvGenerator.Feature f)
Method for disabling specified generator feature (check CsvGenerator.Feature for list of features)


isEnabled

public final boolean isEnabled(CsvGenerator.Feature f)
Check whether specified generator feature is enabled.


createJsonParser

public CsvParser createJsonParser(File f)
                           throws IOException,
                                  com.fasterxml.jackson.core.JsonParseException
Overrides:
createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

createJsonParser

public CsvParser createJsonParser(URL url)
                           throws IOException,
                                  com.fasterxml.jackson.core.JsonParseException
Overrides:
createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

createJsonParser

public CsvParser createJsonParser(InputStream in)
                           throws IOException,
                                  com.fasterxml.jackson.core.JsonParseException
Overrides:
createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

createJsonParser

public CsvParser createJsonParser(byte[] data)
                           throws IOException,
                                  com.fasterxml.jackson.core.JsonParseException
Overrides:
createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

createJsonParser

public CsvParser createJsonParser(byte[] data,
                                  int offset,
                                  int len)
                           throws IOException,
                                  com.fasterxml.jackson.core.JsonParseException
Overrides:
createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

createJsonGenerator

public CsvGenerator createJsonGenerator(OutputStream out,
                                        com.fasterxml.jackson.core.JsonEncoding enc)
                                 throws IOException

note: co-variant return type

Overrides:
createJsonGenerator in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException

createJsonGenerator

public CsvGenerator createJsonGenerator(OutputStream out)
                                 throws IOException
Since Csv format always uses UTF-8 internally, no encoding need to be passed to this method.

Overrides:
createJsonGenerator in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException

_createJsonParser

protected CsvParser _createJsonParser(InputStream in,
                                      com.fasterxml.jackson.core.io.IOContext ctxt)
                               throws IOException,
                                      com.fasterxml.jackson.core.JsonParseException
Overridable factory method that actually instantiates desired parser.

Overrides:
_createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_createJsonParser

protected com.fasterxml.jackson.core.JsonParser _createJsonParser(Reader r,
                                                                  com.fasterxml.jackson.core.io.IOContext ctxt)
                                                           throws IOException,
                                                                  com.fasterxml.jackson.core.JsonParseException
Overridable factory method that actually instantiates desired parser.

Overrides:
_createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_createJsonParser

protected CsvParser _createJsonParser(byte[] data,
                                      int offset,
                                      int len,
                                      com.fasterxml.jackson.core.io.IOContext ctxt)
                               throws IOException,
                                      com.fasterxml.jackson.core.JsonParseException
Overridable factory method that actually instantiates desired parser.

Overrides:
_createJsonParser in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException
com.fasterxml.jackson.core.JsonParseException

_createJsonGenerator

protected com.fasterxml.jackson.core.JsonGenerator _createJsonGenerator(Writer out,
                                                                        com.fasterxml.jackson.core.io.IOContext ctxt)
                                                                 throws IOException
Overridable factory method that actually instantiates desired generator.

Overrides:
_createJsonGenerator in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException

_createWriter

protected Writer _createWriter(OutputStream out,
                               com.fasterxml.jackson.core.JsonEncoding enc,
                               com.fasterxml.jackson.core.io.IOContext ctxt)
                        throws IOException
Overrides:
_createWriter in class com.fasterxml.jackson.core.JsonFactory
Throws:
IOException

_createJsonGenerator

protected CsvGenerator _createJsonGenerator(com.fasterxml.jackson.core.io.IOContext ctxt,
                                            Writer out)
                                     throws IOException
Throws:
IOException

_createReader

protected Reader _createReader(InputStream in,
                               com.fasterxml.jackson.core.JsonEncoding enc,
                               com.fasterxml.jackson.core.io.IOContext ctxt)
                        throws IOException
Throws:
IOException

_createReader

protected Reader _createReader(byte[] data,
                               int offset,
                               int len,
                               com.fasterxml.jackson.core.JsonEncoding enc,
                               com.fasterxml.jackson.core.io.IOContext ctxt)
                        throws IOException
Throws:
IOException


Copyright © 2012 fasterxml.com. All Rights Reserved.