|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.serialization.CSVSerializer
public class CSVSerializer
Implementation of the Serializer
interface that reads data from
and writes data to a comma-separated value (CSV) file.
TODO Add "firstLineContainsKeys" flag.
Nested Class Summary | |
---|---|
class |
CSVSerializer.KeySequence
Class representing the serializers key sequence. |
class |
CSVSerializer.StreamIterator
Allows a caller to retrieve the contents of a CSV stream iteratively. |
Field Summary | |
---|---|
static int |
BUFFER_SIZE
|
static String |
DEFAULT_CHARSET_NAME
|
static String |
MIME_TYPE
|
Constructor Summary | |
---|---|
CSVSerializer()
|
|
CSVSerializer(Charset charset)
|
|
CSVSerializer(String charsetName)
|
Method Summary | |
---|---|
Charset |
getCharset()
|
Class<?> |
getItemClass()
Returns the item class that will be instantiated by the serializer during a read operation. |
CSVSerializer.KeySequence |
getKeys()
Returns a sequence representing the fields that will be read or written by this serializer. |
String |
getMIMEType(List<?> objects)
Returns the MIME type of the data read and written by this serializer. |
CSVSerializer.StreamIterator |
getStreamIterator(InputStream inputStream)
Reads values from a comma-separated value stream. |
CSVSerializer.StreamIterator |
getStreamIterator(Reader reader)
Reads values from a comma-separated value stream. |
List<?> |
readObject(InputStream inputStream)
Reads values from a comma-separated value stream. |
List<?> |
readObject(Reader reader)
Reads values from a comma-separated value stream. |
void |
setItemClass(Class<?> itemClass)
Sets the item class that will be instantiated by the serializer during a read operation. |
void |
writeObject(List<?> items,
OutputStream outputStream)
Writes values to a comma-separated value stream. |
void |
writeObject(List<?> items,
Writer writer)
Writes values to a comma-separated value stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_CHARSET_NAME
public static final String MIME_TYPE
public static final int BUFFER_SIZE
Constructor Detail |
---|
public CSVSerializer()
public CSVSerializer(String charsetName)
public CSVSerializer(Charset charset)
Method Detail |
---|
public Charset getCharset()
public CSVSerializer.KeySequence getKeys()
public Class<?> getItemClass()
public void setItemClass(Class<?> itemClass)
Dictionary
interface.
public List<?> readObject(InputStream inputStream) throws IOException, SerializationException
readObject
in interface Serializer<List<?>>
inputStream
- The input stream from which data will be read.
IOException
SerializationException
readObject(Reader)
public List<?> readObject(Reader reader) throws IOException, SerializationException
reader
- The reader from which data will be read.
IOException
SerializationException
public CSVSerializer.StreamIterator getStreamIterator(InputStream inputStream) throws IOException
inputStream
- The input stream from which data will be read.
IOException
getStreamIterator(Reader)
public CSVSerializer.StreamIterator getStreamIterator(Reader reader) throws IOException
reader
- The reader from which data will be read.
IOException
public void writeObject(List<?> items, OutputStream outputStream) throws IOException, SerializationException
writeObject
in interface Serializer<List<?>>
items
- outputStream
- The output stream to which data will be written.
IOException
SerializationException
writeObject(List, Writer)
public void writeObject(List<?> items, Writer writer) throws IOException
items
- A list containing the data to write to the CSV
file. List items must be instances of Dictionarywriter
- The writer to which data will be written.
IOException
public String getMIMEType(List<?> objects)
Serializer
getMIMEType
in interface Serializer<List<?>>
objects
- If provided, allows the serializer to attach parameters to the returned
MIME type containing more detailed information about the data. If
null, the base MIME type is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |