|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.io.OutputStream
com.tangosol.io.AbstractWriteBuffer.AbstractBufferOutput
com.tangosol.io.ByteArrayWriteBuffer.ByteArrayBufferOutput
public final class ByteArrayWriteBuffer.ByteArrayBufferOutput
ByteArrayBufferOutput is an implementation of BufferOutput optimized for writing to the buffer's underlying byte array.
Field Summary |
---|
Fields inherited from class com.tangosol.io.AbstractWriteBuffer.AbstractBufferOutput |
---|
m_ofWrite |
Fields inherited from interface com.tangosol.io.WriteBuffer.BufferOutput |
---|
MAX_PACKED_INT_SIZE, MAX_PACKED_LONG_SIZE |
Constructor Summary | |
---|---|
ByteArrayWriteBuffer.ByteArrayBufferOutput() Construct an ByteArrayBufferOutput that will begin writing at the start of the containing WriteBuffer. |
|
ByteArrayWriteBuffer.ByteArrayBufferOutput(int of) Construct an ByteArrayBufferOutput that will begin writing at the specified offset within the containing WriteBuffer. |
Method Summary | |
---|---|
protected void |
moveOffset(int cb) Move the offset within the stream forward. |
void |
writeBytes(java.lang.String s) Writes the String s, but only the low-order byte from each character of the String is written. |
void |
writeChars(java.lang.String s) Writes the String s as a sequence of characters. |
void |
writeInt(int n) Writes an int value. |
void |
writeLong(long l) Writes a long value. |
void |
writePackedInt(int n) Write an int value using a variable-length storage-format. |
void |
writePackedLong(long l) Write a long value using a variable-length storage-format. |
void |
writeSafeUTF(java.lang.String s) Write a variable-length encoded UTF packed String. |
void |
writeShort(int n) Writes a short value, comprised of the 16 low-order bits of the argument n; the 16 high-order bits of n are ignored. |
void |
writeUTF(java.lang.String s) Writes the String s as a sequence of characters, but using UTF-8 encoding for the characters, and including the String length data so that the corresponding DataInput.readUTF() method can reconstitute a String from the written data. |
Methods inherited from class com.tangosol.io.AbstractWriteBuffer.AbstractBufferOutput |
---|
calcUTF, close, flush, formatUTF, formatUTF, getBuffer, getCharBuf, getOffset, setOffset, write, write, write, writeBoolean, writeBuffer, writeBuffer, writeByte, writeChar, writeDouble, writeFloat, writeStream, writeStream, writeUTF |
Constructor Detail |
---|
public ByteArrayWriteBuffer.ByteArrayBufferOutput()
public ByteArrayWriteBuffer.ByteArrayBufferOutput(int of)
of
- the offset at which to begin writingMethod Detail |
---|
public void writeShort(int n) throws java.io.IOException
writeShort
in interface WriteBuffer.BufferOutput
writeShort
in interface java.io.DataOutput
writeShort
in class AbstractWriteBuffer.AbstractBufferOutput
n
- the short to write (passed as an integer)java.io.IOException
- if an I/O error occurspublic void writeInt(int n) throws java.io.IOException
writeInt
in interface WriteBuffer.BufferOutput
writeInt
in interface java.io.DataOutput
writeInt
in class AbstractWriteBuffer.AbstractBufferOutput
n
- the int to writejava.io.IOException
- if an I/O error occurspublic void writeLong(long l) throws java.io.IOException
writeLong
in interface WriteBuffer.BufferOutput
writeLong
in interface java.io.DataOutput
writeLong
in class AbstractWriteBuffer.AbstractBufferOutput
l
- the long to writejava.io.IOException
- if an I/O error occurspublic void writeBytes(java.lang.String s) throws java.io.IOException
writeBytes
in interface WriteBuffer.BufferOutput
writeBytes
in interface java.io.DataOutput
writeBytes
in class AbstractWriteBuffer.AbstractBufferOutput
s
- the String to writejava.io.IOException
- if an I/O error occurspublic void writeChars(java.lang.String s) throws java.io.IOException
writeChars
in interface WriteBuffer.BufferOutput
writeChars
in interface java.io.DataOutput
writeChars
in class AbstractWriteBuffer.AbstractBufferOutput
s
- the String to writejava.io.IOException
- if an I/O error occurspublic void writeUTF(java.lang.String s) throws java.io.IOException
DataInput.readUTF()
method can reconstitute a String from the written data.writeUTF
in interface WriteBuffer.BufferOutput
writeUTF
in interface java.io.DataOutput
writeUTF
in class AbstractWriteBuffer.AbstractBufferOutput
s
- the String to writejava.io.IOException
- if an I/O error occurspublic void writeSafeUTF(java.lang.String s) throws java.io.IOException
The binary format for a Safe UTF value is a "packed int" for the binary length followed by the UTF-encoded byte stream. The length is either -1 (indicating a null String) or in the range 0 .. Integer.MAX_VALUE (inclusive). The UTF-encoded portion uses a format identical to DataOutput.
writeSafeUTF
in interface WriteBuffer.BufferOutput
writeSafeUTF
in class AbstractWriteBuffer.AbstractBufferOutput
s
- a String value to write; may be nulljava.io.IOException
- if an I/O error occurspublic void writePackedInt(int n) throws java.io.IOException
The format differs from DataOutput in that DataOutput always uses a fixed-length 4-byte Big Endian binary format for int values. The "packed" format includes a sign bit (0x40) and a continuation bit (0x80) in the first byte, followed by the least 6 significant bits of the int value. Subsequent bytes (each appearing only if the previous byte had its continuation bit set) include a continuation bit (0x80) and the next least 7 significant bits of the int value. In this way, a 32-bit value is encoded into 1-5 bytes, depending on the magnitude of the int value being encoded.
writePackedInt
in interface WriteBuffer.BufferOutput
writePackedInt
in class AbstractWriteBuffer.AbstractBufferOutput
n
- an int value to writejava.io.IOException
- if an I/O error occurspublic void writePackedLong(long l) throws java.io.IOException
The format differs from DataOutput in that DataOutput always uses a fixed-length 8-byte Big Endian binary format for long values. The "packed" format includes a sign bit (0x40) and a continuation bit (0x80) in the first byte, followed by the least 6 significant bits of the long value. Subsequent bytes (each appearing only if the previous byte had its continuation bit set) include a continuation bit (0x80) and the next least 7 significant bits of the long value. In this way, a 64-bit value is encoded into 1-10 bytes, depending on the magnitude of the long value being encoded.
writePackedLong
in interface WriteBuffer.BufferOutput
writePackedLong
in class AbstractWriteBuffer.AbstractBufferOutput
l
- a long value to writejava.io.IOException
- if an I/O error occursprotected void moveOffset(int cb)
cb
- the number of bytes to advance the offset
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |