Decoder that ensures that the sequence of
operations conforms to a schema.
Use DecoderFactory#validatingDecoder(Schema, Decoder) to construct
and configure.
ValidatingDecoder is not thread-safe.
Decoder, DecoderFactory
| Modifier and Type | Field and Description |
|---|---|
| protected Decoder |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public long | arrayNext()
Implements abstract org. |
| private void | |
| public ValidatingDecoder | |
| public Symbol | doAction(Symbol
The input symbol from the caller of advance input, Symbol The symbol at the top the stack. top)Implements org. |
| private static Symbol | |
| public long | mapNext()
Implements abstract org. |
| public long | readArrayStart()
Implements abstract org. |
| public boolean | readBoolean()
Implements abstract org. Encoder#writeBoolean.
|
| public ByteBuffer | readBytes(ByteBuffer old)
Implements abstract org. Encoder#writeBytes.
|
| public double | readDouble()
Implements abstract org. Encoder#writeDouble.
|
| public int | |
| public void | readFixed(byte[]
The buffer to store the contents being read. bytes, int The position where the data needs to be written. start, int The size of the binary object. len)Implements abstract org. |
| public float | readFloat()
Implements abstract org. Encoder#writeFloat.
|
| public int | readIndex()
Implements abstract org. Encoder#writeIndex.
|
| public int | readInt()
Implements abstract org. Encoder#writeInt.
|
| public long | readLong()
Implements abstract org. Encoder#writeLong.
|
| public long | readMapStart()
Implements abstract org. |
| public void | |
| public Utf8 | readString(Utf8 old)
Implements abstract org. Encoder#writeString.
|
| public String | readString()
Implements abstract org. Encoder#writeString.
|
| public long | skipArray()
Implements abstract org. |
| public void | skipBytes()
Implements abstract org. Encoder#writeBytes.
|
| public void | skipFixed(int
The size of the binary object to be skipped. length)Implements abstract org. |
| protected void | |
| public long | skipMap()
Implements abstract org. skipArray.
|
| public void | skipString()
Implements abstract org. Encoder#writeString.
|
| in | back to summary |
|---|---|
| protected Decoder in | |
| ValidatingDecoder | back to summary |
|---|---|
| pack-priv ValidatingDecoder(Symbol root, Decoder in) throws IOException | |
| ValidatingDecoder | back to summary |
|---|---|
| pack-priv ValidatingDecoder(Schema schema, Decoder in) throws IOException | |
| arrayNext | back to summary |
|---|---|
| public long arrayNext() throws IOException Implements abstract org. Doc from org. Processes the next block of an array and returns the number of items in the block and let's the caller read those items.
| |
| checkFixed | back to summary |
|---|---|
| private void checkFixed(int size) throws IOException | |
| configure | back to summary |
|---|---|
| public ValidatingDecoder configure(Decoder in) throws IOException Re-initialize, reading from a new underlying Decoder. | |
| doAction | back to summary |
|---|---|
| public Symbol doAction(Symbol input, Symbol top) throws IOException Implements org. Doc from org. Handle the action symbol top when the input is sought to be taken off the stack. | |
| getSymbol | back to summary |
|---|---|
| private static Symbol getSymbol(Schema schema) | |
| mapNext | back to summary |
|---|---|
| public long mapNext() throws IOException Implements abstract org. Doc from org. Processes the next block of map entries and returns the count of them.
Similar to
| |
| readArrayStart | back to summary |
|---|---|
| public long readArrayStart() throws IOException Implements abstract org. Doc from org. Reads and returns the size of the first block of an array. If this method
returns non-zero, then the caller should read the indicated number of items,
and then call
for(long i = in.readArrayStart(); i != 0; i = in.arrayNext()) {
for (long j = 0; j < i; j++) {
read next element of the array;
}
}
| |
| readBoolean | back to summary |
|---|---|
| public boolean readBoolean() throws IOException Implements abstract org. Doc from org. Reads a boolean value written by
| |
| readBytes | back to summary |
|---|---|
| public ByteBuffer readBytes(ByteBuffer old) throws IOException Implements abstract org. Doc from org. Reads a byte-string written by
| |
| readDouble | back to summary |
|---|---|
| public double readDouble() throws IOException Implements abstract org. Doc from org. Reads a double written by
| |
| readEnum | back to summary |
|---|---|
| public int readEnum() throws IOException Implements abstract org. Doc from org. Reads an enumeration.
| |
| readFixed | back to summary |
|---|---|
| public void readFixed(byte[] bytes, int start, int len) throws IOException Implements abstract org. Doc from org. Reads fixed sized binary object.
| |
| readFloat | back to summary |
|---|---|
| public float readFloat() throws IOException Implements abstract org. Doc from org. Reads a float written by
| |
| readIndex | back to summary |
|---|---|
| public int readIndex() throws IOException Implements abstract org. Doc from org. Reads the tag of a union written by
| |
| readInt | back to summary |
|---|---|
| public int readInt() throws IOException Implements abstract org. Doc from org. Reads an integer written by
| |
| readLong | back to summary |
|---|---|
| public long readLong() throws IOException Implements abstract org. Doc from org. Reads a long written by
| |
| readMapStart | back to summary |
|---|---|
| public long readMapStart() throws IOException Implements abstract org. Doc from org. Reads and returns the size of the next block of map-entries. Similar to
Map
| |
| readNull | back to summary |
|---|---|
| public void readNull() throws IOException Implements abstract org. Doc from org. "Reads" a null value. (Doesn't actually read anything, but advances the state of the parser if the implementation is stateful.)
| |
| readString | back to summary |
|---|---|
| public Utf8 readString(Utf8 old) throws IOException Implements abstract org. Doc from org. Reads a char-string written by
| |
| readString | back to summary |
|---|---|
| public String readString() throws IOException Implements abstract org. Doc from org. Reads a char-string written by
| |
| skipArray | back to summary |
|---|---|
| public long skipArray() throws IOException Implements abstract org. Doc from org. Used for quickly skipping through an array. Note you can either skip the
entire array, or read the entire array (with
for(long i = in.skipArray(); i != 0; i = i.skipArray()) {
for (long j = 0; j < i; j++) {
read and discard the next element of the array;
}
}
Note that this method can automatically skip through items if a byte-count is
found in the underlying data, or if a schema has been provided to the
implementation, but otherwise the client will have to skip through items
itself.
| |
| skipBytes | back to summary |
|---|---|
| public void skipBytes() throws IOException Implements abstract org. Doc from org. Discards a byte-string written by
| |
| skipFixed | back to summary |
|---|---|
| public void skipFixed(int length) throws IOException Implements abstract org. Doc from org. Discards fixed sized binary object.
| |
| skipFixed | back to summary |
|---|---|
| protected void skipFixed() throws IOException Implements abstract org.
| |
| skipMap | back to summary |
|---|---|
| public long skipMap() throws IOException Implements abstract org. Doc from org. Support for quickly skipping through a map similar to
for (long i = in.skipMap(); i != 0; i = in.skipMap()) {
for (long j = 0; j < i; j++) {
in.skipString(); // Discard key
in.readInt(); // Discard int-field of value
in.readBoolean(); // Discard boolean-field of value
}
}
| |
| skipString | back to summary |
|---|---|
| public void skipString() throws IOException Implements abstract org. Doc from org. Discards a char-string written by
| |