public class UnsafeByteArrayOutputStream extends com.esotericsoftware.kryo.io.Output implements ExtendedDataOutput
| Constructor and Description |
|---|
UnsafeByteArrayOutputStream()
Constructor
|
UnsafeByteArrayOutputStream(byte[] buf)
Constructor to take in a buffer
|
UnsafeByteArrayOutputStream(byte[] buf,
int pos)
Constructor to take in a buffer with a given position into that buffer
|
UnsafeByteArrayOutputStream(int size)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
ensureWritable(int minSize)
Ensure that backing byte structure has at least minSize
additional bytes
|
byte[] |
getByteArray()
Get the internal byte array (if possible), read-only
|
int |
getPos()
Get the position in the output stream
|
protected boolean |
require(int size)
Ensure that this buffer has enough remaining space to add the size.
|
void |
reset()
Clears the buffer
|
void |
skipBytes(int bytesToSkip)
Skip some number of bytes.
|
byte[] |
toByteArray()
Copies the internal byte array
|
byte[] |
toByteArray(int offset,
int length)
Return a copy of slice of byte array
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s) |
void |
writeChar(char v) |
void |
writeChar(int v) |
void |
writeChars(String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeInt(int pos,
int value)
In order to write a size as a first part of an data output, it is
useful to be able to write an int at an arbitrary location in the stream
|
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(String s) |
clear, close, flush, getBuffer, getOutputStream, intLength, longLength, position, setBuffer, setBuffer, setOutputStream, setPosition, toBytes, total, writeAscii, writeByte, writeBytes, writeBytes, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeInts, writeLong, writeLongs, writeLongs, writeShorts, writeString, writeString, writeVarInt, writeVarLongpublic UnsafeByteArrayOutputStream()
public UnsafeByteArrayOutputStream(int size)
size - Initial size of the underlying byte arraypublic UnsafeByteArrayOutputStream(byte[] buf)
buf - Buffer to start with, or if null, create own bufferpublic UnsafeByteArrayOutputStream(byte[] buf,
int pos)
buf - Buffer to start withpos - Position to write at the bufferprotected boolean require(int size)
require in class com.esotericsoftware.kryo.io.Outputsize - Size to addpublic byte[] getByteArray()
ExtendedDataOutputgetByteArray in interface ExtendedDataOutputpublic byte[] toByteArray()
ExtendedDataOutputtoByteArray in interface ExtendedDataOutputpublic byte[] toByteArray(int offset,
int length)
ExtendedDataOutputtoByteArray in interface ExtendedDataOutputoffset - offset of arraylength - length of slicepublic void reset()
ExtendedDataOutputreset in interface ExtendedDataOutputpublic int getPos()
ExtendedDataOutputgetPos in interface ExtendedDataOutputpublic void write(int b)
write in interface DataOutputwrite in class com.esotericsoftware.kryo.io.Outputpublic void write(byte[] b)
write in interface DataOutputwrite in class com.esotericsoftware.kryo.io.Outputpublic void write(byte[] b,
int off,
int len)
write in interface DataOutputwrite in class com.esotericsoftware.kryo.io.Outputpublic void writeBoolean(boolean v)
writeBoolean in interface DataOutputwriteBoolean in class com.esotericsoftware.kryo.io.Outputpublic void writeByte(int v)
writeByte in interface DataOutputwriteByte in class com.esotericsoftware.kryo.io.Outputpublic void writeShort(int v)
writeShort in interface DataOutputwriteShort in class com.esotericsoftware.kryo.io.Outputpublic void writeChar(int v)
throws IOException
writeChar in interface DataOutputIOExceptionpublic void writeChar(char v)
writeChar in class com.esotericsoftware.kryo.io.Outputpublic void writeInt(int v)
writeInt in interface DataOutputwriteInt in class com.esotericsoftware.kryo.io.Outputpublic void ensureWritable(int minSize)
ExtendedDataOutputensureWritable in interface ExtendedDataOutputminSize - additional size requiredpublic void skipBytes(int bytesToSkip)
ExtendedDataOutputskipBytes in interface ExtendedDataOutputbytesToSkip - Number of bytes to skippublic void writeInt(int pos,
int value)
ExtendedDataOutputwriteInt in interface ExtendedDataOutputpos - Byte position in the output streamvalue - Value to writepublic void writeLong(long v)
writeLong in interface DataOutputwriteLong in class com.esotericsoftware.kryo.io.Outputpublic void writeFloat(float v)
writeFloat in interface DataOutputwriteFloat in class com.esotericsoftware.kryo.io.Outputpublic void writeDouble(double v)
writeDouble in interface DataOutputwriteDouble in class com.esotericsoftware.kryo.io.Outputpublic void writeBytes(String s) throws IOException
writeBytes in interface DataOutputIOExceptionpublic void writeChars(String s) throws IOException
writeChars in interface DataOutputIOExceptionpublic void writeUTF(String s) throws IOException
writeUTF in interface DataOutputIOExceptionCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.