- All Known Implementing Classes:
OctetDataReader
A message constructed by a DataWriter may only contain object at top-level. Therefore the first call to an
instance of DataReader must be beginObject().
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintStarts reading an array.voidStarts reading an object.voidendArray()Finishes reading the array started withbeginArray().voidFinishes reading the object started with the last call tobeginObject().booleanhasNext()byte[]Reads a binary string value.Reads a binary stream value.default booleanReads a boolean value.doubleReads a 64 bit double value.floatReads a 32 bit float value.intnextInt()Reads an (unsigned) integer value.intReads a full 32 bit integer value.intReads a signed integer value.longnextLong()Reads an (unsigned) long value.longReads a full 64 bit long value.longReads a signed long value.intnextName()Whenreading an object, retrieves the next field identifier.Reads an utf-8Stringvalue.voidSkips the current value to read.
-
Method Details
-
beginObject
Starts reading an object.After this call, an alternating sequence of calls to
nextName()followed by a value retrieval method such asnextInt(),...nextString()followed by a final call toendObject()is expected.- Throws:
IOException- If reading fails.
-
endObject
Finishes reading the object started with the last call tobeginObject().- Throws:
IOException- If reading fails.
-
hasNext
- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextName
Whenreading an object, retrieves the next field identifier.Note:
hasNext()must returntrueto be able to read the next field identifier.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextBoolean
Reads a boolean value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextInt
Reads an (unsigned) integer value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextIntSigned
Reads a signed integer value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextIntFixed
Reads a full 32 bit integer value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextLong
Reads an (unsigned) long value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextLongSigned
Reads a signed long value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextLongFixed
Reads a full 64 bit long value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextFloat
Reads a 32 bit float value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextDouble
Reads a 64 bit double value.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextString
Reads an utf-8Stringvalue.- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextBinary
Reads a binary string value.The value might have been produced by
DataWriter.value(byte[]), orDataWriter.valueBinaryStream(). Best efficiency is achieved, if a value produced withDataWriter.valueBinaryStream()is read bynextBinaryStream().- Returns:
- The retrieved value.
- Throws:
IOException- If reading fails.
-
nextBinaryStream
Reads a binary stream value.The value might have been produced by
DataWriter.value(byte[]), orDataWriter.valueBinaryStream(). Best efficiency is achieved, if a value produced withDataWriter.valueBinaryStream()is read bynextBinaryStream().- Returns:
- The retrieved value as stream.
- Throws:
IOException- If reading fails.
-
beginArray
Starts reading an array.- Returns:
- The number of array elements to read.
- Throws:
IOException- If reading fails.
-
endArray
Finishes reading the array started withbeginArray().- Throws:
IOException- If reading fails.
-
skipValue
Skips the current value to read.- Throws:
IOException- If reading fails.
-