public interface RecordContentReader extends ContentReader
Allows content to be read in record/field format.
Such a reader may be created using
ContentFactory.newReader(Class, Content)
, for example:
ContentFactory factory = Diffusion.content();
RecordContentReader reader = factory.newReader(RecordContentReader.class, content);
Modifier and Type | Method and Description |
---|---|
void |
charset(Charset charset)
Deprecated.
This method is for backward compatibility with Classic API
clients only. Deprecated since 5.3.
|
boolean |
hasMoreFields()
Indicates whether are more fields to read.
|
boolean |
hasMoreRecords()
Indicates whether are more records to read.
|
String |
nextField()
Returns a field of string data from the current content position.
|
Record |
nextRecord()
Returns a record of string data from the current content position.
|
void |
reset()
Reset the reader so that it can be used to start reading the content
again from the beginning.
|
Record nextRecord()
This returns a record of String data read from the current content
position to the next record delimiter
within the content or the end of the content.
Fields (areas delimited by field
delimiters
) are unpacked from within the record area. If there is data
but there are no field delimiters, the returned record would contain only
one field.
hasMoreRecords()
may be called before calling this method to
determine whether there any records to read.
Empty content is equivalent to no records.
A single empty record in the content may be represented by a single
Record.RECORD_MU
delimiter. This is the only way of
distinguishing between a single empty record and no records.
A record containing a single empty field may be represented by a single
Record.FIELD_MU
between record delimiters, before the first
record delimiter or after the final record delimiter. This is the only
way of distinguishing between an empty record and a record containing a
single empty field.
After calling this method the content position will be moved beyond the record read.
hasMoreRecords()
is false)String nextField()
This returns a field of String data constructed from bytes read from the
current content position to the next field
delimiter
(or record delimiter
) within
the content or the end of the content.
hasMoreFields()
may be called before calling this method to
determine whether there are any more fields to read.
After calling this method the content pointer will be moved beyond the delimiter found.
Empty content is equivalent to no fields. A single empty field may be
represented by content containing a single Record.FIELD_MU
delimiter.
hasMoreFields()
is false)boolean hasMoreFields()
boolean hasMoreRecords()
@Deprecated void charset(Charset charset) throws IllegalArgumentException
No metadata is included within the content to indicate the character set.
It is the caller's responsibility to set the character set to match that
used to encode
the content..
The default character set is UTF-8. This method is provided for backward compatibility with Classic API clients that use character sets other than UTF-8 and may be removed in a future version of the product.
Note that calling this method will also reset()
the reader.
charset
- the character setIllegalArgumentException
- if charset
is nullvoid reset()
Copyright © 2016 Push Technology Ltd. All Rights Reserved.