T - The type of the real object that will be parsedpublic interface ParserWriter<T>
ParserWriter can "parse" a InputStream into a real object
and vice versa (write an Object to the original data format, like json, xml
or evene binary image data etc.)| Modifier and Type | Field and Description |
|---|---|
static int |
COLLECTION_TYPE_LIST
Indicates, that the result of the parsing process should be returned as
List. the default List implementation is ArrayList
|
static int |
COLLECTION_TYPE_NONE
|
| Modifier and Type | Method and Description |
|---|---|
T |
parse(InputStream in,
Class<?> targetClass,
int collectionType,
String mimeType,
String charset)
Take a
InputStream and parse it to a "real" object |
void |
write(OutputStream out,
T value,
String mimeType,
String charset)
This method writes the passed oject to an outputstream
|
void |
writeRaw(OutputStream out,
byte[] value,
String mimeType,
String charset)
Write the data as raw bytes
|
static final int COLLECTION_TYPE_NONE
List,
Map, etc ...static final int COLLECTION_TYPE_LIST
T parse(InputStream in, Class<?> targetClass, int collectionType, String mimeType, String charset) throws Exception
InputStream and parse it to a "real" objectin - The InputStreamtargetClass - The Target class the data should be parsed in. Normally only used if json or xml should be parsed.collectionType - Here you specify which kind omimeType - The mimeType, because for example a image parser can parse JPG
and PNG and GIF in the same procedurecharset - The charset that is used for string text encoding. For binary
data this parameter is useless and can be ingnoredExceptionvoid write(OutputStream out, T value, String mimeType, String charset) throws Exception
out - value - mimeType - the mime type that should be writtencharset - The charset that is used for string text encoding. For binary
data this parameter is useless and can be ingnoredExceptionvoid writeRaw(OutputStream out, byte[] value, String mimeType, String charset) throws IOException
out - value - mimeType - charset - IOExceptionCopyright © 2015 Hannes Dorfmann. All rights reserved.