Interface ObjectParser (1.43.0)

public interface ObjectParser

Parses a data source into the specified data type.

Implementations should normally be thread-safe.

Methods

<T>parseAndClose(InputStream in, Charset charset, Class<T> dataClass)

public abstract T <T>parseAndClose(InputStream in, Charset charset, Class<T> dataClass)

Parses the given input stream into a new instance of the the given data class of key/value pairs and closes the input stream.

Parameters
NameDescription
inInputStream

input stream which contains the data to parse

charsetCharset

charset which should be used to decode the input stream or null if unknown

dataClassClass<T>

class into which the data is parsed

Returns
TypeDescription
T
Exceptions
TypeDescription
IOException

<T>parseAndClose(Reader reader, Class<T> dataClass)

public abstract T <T>parseAndClose(Reader reader, Class<T> dataClass)

Parses the given reader into a new instance of the the given data class of key/value pairs and closes the reader.

Parameters
NameDescription
readerReader

reader which contains the text data to parse

dataClassClass<T>

class into which the data is parsed

Returns
TypeDescription
T
Exceptions
TypeDescription
IOException

parseAndClose(InputStream in, Charset charset, Type dataType)

public abstract Object parseAndClose(InputStream in, Charset charset, Type dataType)

Parses the given input stream into a new instance of the the given data type of key/value pairs and closes the input stream.

Parameters
NameDescription
inInputStream

input stream which contains the data to parse

charsetCharset

charset which should be used to decode the input stream or null if unknown

dataTypeType

type into which the data is parsed

Returns
TypeDescription
Object
Exceptions
TypeDescription
IOException

parseAndClose(Reader reader, Type dataType)

public abstract Object parseAndClose(Reader reader, Type dataType)

Parses the given reader into a new instance of the the given data type of key/value pairs and closes the reader.

Parameters
NameDescription
readerReader

reader which contains the text data to parse

dataTypeType

type into which the data is parsed

Returns
TypeDescription
Object
Exceptions
TypeDescription
IOException