public class TupleOutput extends FastOutputStream
OutputStream
with DataOutput
-like methods for
writing tuple fields. It is used by TupleBinding
.
This class has many methods that have the same signatures as methods in
the DataOutput
interface. The reason this class does not
implement DataOutput
is because it would break the interface
contract for those methods because of data format differences.
DEFAULT_BUMP_SIZE, DEFAULT_INIT_SIZE
Constructor and Description |
---|
TupleOutput()
Creates a tuple output object for writing a byte array of tuple data.
|
TupleOutput(byte[] buffer)
Creates a tuple output object for writing a byte array of tuple data,
using a given buffer.
|
Modifier and Type | Method and Description |
---|---|
static int |
getBigDecimalMaxByteLength(java.math.BigDecimal val)
Returns the maximum byte length that would be output for a given
BigDecimal value if writeBigDecimal(java.math.BigDecimal) were called. |
static int |
getBigIntegerByteLength(java.math.BigInteger val)
Returns the exact byte length that would would be output for a given
BigInteger value if writeBigInteger(java.math.BigInteger) were
called. |
static int |
getSortedBigDecimalMaxByteLength(java.math.BigDecimal val)
Returns the maximum byte length that would be output for a given
BigDecimal value if writeSortedBigDecimal(java.math.BigDecimal) were
called. |
TupleOutput |
writeBigDecimal(java.math.BigDecimal val)
Writes an unsorted
BigDecimal . |
TupleOutput |
writeBigInteger(java.math.BigInteger val)
Writes a
BigInteger . |
TupleOutput |
writeBoolean(boolean val)
Writes a boolean (one byte) unsigned value to the buffer, writing one
if the value is true and zero if it is false.
|
TupleOutput |
writeByte(int val)
Writes an signed byte (one byte) value to the buffer.
|
TupleOutput |
writeBytes(char[] chars)
Writes the specified bytes to the buffer, converting each character to
an unsigned byte value.
|
TupleOutput |
writeBytes(java.lang.String val)
Writes the specified bytes to the buffer, converting each character to
an unsigned byte value.
|
TupleOutput |
writeChar(int val)
Writes a char (two byte) unsigned value to the buffer.
|
TupleOutput |
writeChars(char[] chars)
Writes the specified characters to the buffer, converting each character
to a two byte unsigned value.
|
TupleOutput |
writeChars(java.lang.String val)
Writes the specified characters to the buffer, converting each character
to a two byte unsigned value.
|
TupleOutput |
writeDouble(double val)
Writes an unsorted double (eight byte) value to the buffer.
|
TupleOutput |
writeFloat(float val)
Writes an unsorted float (four byte) value to the buffer.
|
TupleOutput |
writeInt(int val)
Writes an signed int (four byte) value to the buffer.
|
TupleOutput |
writeLong(long val)
Writes an signed long (eight byte) value to the buffer.
|
TupleOutput |
writePackedInt(int val)
Writes an unsorted packed integer.
|
TupleOutput |
writePackedLong(long val)
Writes an unsorted packed long integer.
|
TupleOutput |
writeShort(int val)
Writes an signed short (two byte) value to the buffer.
|
TupleOutput |
writeSortedBigDecimal(java.math.BigDecimal val)
Writes a sorted
BigDecimal . |
TupleOutput |
writeSortedDouble(double val)
Writes a sorted double (eight byte) value to the buffer.
|
TupleOutput |
writeSortedFloat(float val)
Writes a sorted float (four byte) value to the buffer.
|
TupleOutput |
writeSortedPackedInt(int val)
Writes a sorted packed integer.
|
TupleOutput |
writeSortedPackedLong(long val)
Writes a sorted packed long integer.
|
TupleOutput |
writeString(char[] chars)
Writes the specified characters to the buffer, converting each character
to UTF format.
|
TupleOutput |
writeString(java.lang.String val)
Writes the specified characters to the buffer, converting each character
to UTF format, and adding a null terminator byte.
|
TupleOutput |
writeUnsignedByte(int val)
Writes an unsigned byte (one byte) value to the buffer.
|
TupleOutput |
writeUnsignedInt(long val)
Writes an unsigned int (four byte) value to the buffer.
|
TupleOutput |
writeUnsignedShort(int val)
Writes an unsigned short (two byte) value to the buffer.
|
addSize, getBufferBytes, getBufferLength, getBufferOffset, makeSpace, reset, size, toByteArray, toString, toString, write, write, write, writeFast, writeFast, writeFast, writeTo
public TupleOutput()
public TupleOutput(byte[] buffer)
buffer
- is the byte array to use as the buffer.public final TupleOutput writeBytes(java.lang.String val)
TupleInput.readBytes(int)
.val
- is the string containing the values to be written.
Only characters with values below 0x100 may be written using this
method, since the high-order 8 bits of all characters are discarded.java.lang.NullPointerException
- if the val parameter is null.public final TupleOutput writeChars(java.lang.String val)
TupleInput.readChars(int)
.val
- is the string containing the characters to be written.java.lang.NullPointerException
- if the val parameter is null.public final TupleOutput writeString(java.lang.String val)
TupleInput.readString()
.val
- is the string containing the characters to be written.public final TupleOutput writeChar(int val)
TupleInput.readChar()
.val
- is the value to write to the buffer.public final TupleOutput writeBoolean(boolean val)
TupleInput.readBoolean()
.val
- is the value to write to the buffer.public final TupleOutput writeByte(int val)
TupleInput.readByte()
.val
- is the value to write to the buffer.public final TupleOutput writeShort(int val)
TupleInput.readShort()
.val
- is the value to write to the buffer.public final TupleOutput writeInt(int val)
TupleInput.readInt()
.val
- is the value to write to the buffer.public final TupleOutput writeLong(long val)
TupleInput.readLong()
.val
- is the value to write to the buffer.public final TupleOutput writeFloat(float val)
TupleInput.readFloat()
.val
- is the value to write to the buffer.public final TupleOutput writeDouble(double val)
TupleInput.readDouble()
.val
- is the value to write to the buffer.public final TupleOutput writeSortedFloat(float val)
TupleInput.readSortedFloat()
.val
- is the value to write to the buffer.public final TupleOutput writeSortedDouble(double val)
TupleInput.readSortedDouble()
.val
- is the value to write to the buffer.public final TupleOutput writeBytes(char[] chars)
TupleInput.readBytes(int)
.chars
- is the array of values to be written.
Only characters with values below 0x100 may be written using this
method, since the high-order 8 bits of all characters are discarded.java.lang.NullPointerException
- if the chars parameter is null.public final TupleOutput writeChars(char[] chars)
TupleInput.readChars(int)
.chars
- is the array of characters to be written.java.lang.NullPointerException
- if the chars parameter is null.public final TupleOutput writeString(char[] chars)
TupleInput.readString(int)
or TupleInput.readString(char[])
.chars
- is the array of characters to be written.java.lang.NullPointerException
- if the chars parameter is null.public final TupleOutput writeUnsignedByte(int val)
TupleInput.readUnsignedByte()
.val
- is the value to write to the buffer.public final TupleOutput writeUnsignedShort(int val)
TupleInput.readUnsignedShort()
.val
- is the value to write to the buffer.public final TupleOutput writeUnsignedInt(long val)
TupleInput.readUnsignedInt()
.val
- is the value to write to the buffer.public final TupleOutput writePackedInt(int val)
val
- is the value to write to the buffer.public final TupleOutput writePackedLong(long val)
val
- is the value to write to the buffer.public final TupleOutput writeSortedPackedInt(int val)
val
- is the value to write to the buffer.public final TupleOutput writeSortedPackedLong(long val)
val
- is the value to write to the buffer.public final TupleOutput writeBigInteger(java.math.BigInteger val)
BigInteger
.val
- is the value to write to the buffer.java.lang.NullPointerException
- if val is null.java.lang.IllegalArgumentException
- if the byte array representation of val
is larger than 0x7fff bytes.public static int getBigIntegerByteLength(java.math.BigInteger val)
BigInteger
value if writeBigInteger(java.math.BigInteger)
were
called.val
- the BigIntegerpublic final TupleOutput writeBigDecimal(java.math.BigDecimal val)
BigDecimal
.val
- is the value to write to the buffer.java.lang.NullPointerException
- if val is null.public static int getBigDecimalMaxByteLength(java.math.BigDecimal val)
BigDecimal
value if writeBigDecimal(java.math.BigDecimal)
were called.val
- the BigDecimal.public final TupleOutput writeSortedBigDecimal(java.math.BigDecimal val)
BigDecimal
.val
- is the value to write to the buffer.public static int getSortedBigDecimalMaxByteLength(java.math.BigDecimal val)
BigDecimal
value if writeSortedBigDecimal(java.math.BigDecimal)
were
called.val
- the BigDecimal.Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.