public class ByteArray extends Object implements IDataInput, IDataOutput
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.mina.core.buffer.IoBuffer |
data
Internal storage for array contents.
|
protected IDataInput |
dataInput
Object used to read from array.
|
protected IDataOutput |
dataOutput
Object used to write to array.
|
| Modifier | Constructor and Description |
|---|---|
|
ByteArray()
Public constructor.
|
protected |
ByteArray(org.apache.mina.core.buffer.IoBuffer buffer,
int length)
Internal constructor used to create ByteArray during deserialization.
|
| Modifier and Type | Method and Description |
|---|---|
int |
bytesAvailable()
Return number of bytes available for reading.
|
void |
compress()
Compress contents using zlib.
|
boolean |
equals(Object obj) |
protected org.apache.mina.core.buffer.IoBuffer |
getData()
Get internal data.
|
ByteOrder |
getEndian()
Return the byteorder used when loading values.
|
int |
hashCode() |
int |
length()
Return total number of bytes in array.
|
int |
position()
Get the current position in the data.
|
void |
position(int position)
Set the current position in the data.
|
protected void |
prepareIO()
Create internal objects used for reading and writing.
|
boolean |
readBoolean()
Read boolean value.
|
byte |
readByte()
Read signed single byte value.
|
void |
readBytes(byte[] bytes)
Read list of bytes.
|
void |
readBytes(byte[] bytes,
int offset)
Read list of bytes to given offset.
|
void |
readBytes(byte[] bytes,
int offset,
int length)
Read given number of bytes to given offset.
|
double |
readDouble()
Read double-precision floating point value.
|
float |
readFloat()
Read single-precision floating point value.
|
int |
readInt()
Read signed integer value.
|
String |
readMultiByte(int length,
String charSet)
Read multibyte string.
|
Object |
readObject()
Read arbitrary object.
|
short |
readShort()
Read signed short value.
|
int |
readUnsignedByte()
Read unsigned single byte value.
|
long |
readUnsignedInt()
Read unsigned integer value.
|
int |
readUnsignedShort()
Read unsigned short value.
|
String |
readUTF()
Read UTF-8 encoded string.
|
String |
readUTFBytes(int length)
Read UTF-8 encoded string with given length.
|
void |
setEndian(ByteOrder endian)
Set the byteorder to use when loading values.
|
String |
toString()
Return string representation of the array's contents.
|
void |
uncompress()
Decompress contents using zlib.
|
void |
writeBoolean(boolean value)
Write boolean value.
|
void |
writeByte(byte value)
Write signed byte value.
|
void |
writeBytes(byte[] bytes)
Write multiple bytes.
|
void |
writeBytes(byte[] bytes,
int offset)
Write multiple bytes from given offset.
|
void |
writeBytes(byte[] bytes,
int offset,
int length)
Write given number of bytes from given offset.
|
void |
writeDouble(double value)
Write double-precision floating point value.
|
void |
writeFloat(float value)
Write single-precision floating point value.
|
void |
writeInt(int value)
Write signed integer value.
|
void |
writeMultiByte(String value,
String encoding)
Write string in given character set.
|
void |
writeObject(Object value)
Write arbitrary object.
|
void |
writeShort(short value)
Write signed short value.
|
void |
writeUnsignedInt(long value)
Write unsigned integer value.
|
void |
writeUTF(String value)
Write UTF-8 encoded string.
|
void |
writeUTFBytes(String value)
Write UTF-8 encoded string as byte array.
|
protected org.apache.mina.core.buffer.IoBuffer data
protected IDataInput dataInput
protected IDataOutput dataOutput
protected ByteArray(org.apache.mina.core.buffer.IoBuffer buffer,
int length)
buffer - io bufferlength - lengthpublic ByteArray()
protected void prepareIO()
protected org.apache.mina.core.buffer.IoBuffer getData()
public int position()
public void position(int position)
position - position to setpublic int bytesAvailable()
public int length()
public void compress()
public void uncompress()
public ByteOrder getEndian()
getEndian in interface IDataInputgetEndian in interface IDataOutputpublic boolean readBoolean()
readBoolean in interface IDataInputpublic byte readByte()
readByte in interface IDataInputpublic void readBytes(byte[] bytes)
readBytes in interface IDataInputbytes - destination for read bytespublic void readBytes(byte[] bytes,
int offset)
readBytes in interface IDataInputbytes - destination for read bytesoffset - offset in destination to write topublic void readBytes(byte[] bytes,
int offset,
int length)
readBytes in interface IDataInputbytes - destination for read bytesoffset - offset in destination to write tolength - number of bytes to readpublic double readDouble()
readDouble in interface IDataInputpublic float readFloat()
readFloat in interface IDataInputpublic int readInt()
readInt in interface IDataInputpublic String readMultiByte(int length, String charSet)
readMultiByte in interface IDataInputlength - length of string to readcharSet - character set of string to readpublic Object readObject()
readObject in interface IDataInputpublic short readShort()
readShort in interface IDataInputpublic String readUTF()
readUTF in interface IDataInputpublic String readUTFBytes(int length)
readUTFBytes in interface IDataInputlength - the length of the stringpublic int readUnsignedByte()
readUnsignedByte in interface IDataInputpublic long readUnsignedInt()
readUnsignedInt in interface IDataInputpublic int readUnsignedShort()
readUnsignedShort in interface IDataInputpublic void setEndian(ByteOrder endian)
setEndian in interface IDataInputsetEndian in interface IDataOutputendian - the byteorder to usepublic void writeBoolean(boolean value)
writeBoolean in interface IDataOutputvalue - the valuepublic void writeByte(byte value)
writeByte in interface IDataOutputvalue - the valuepublic void writeBytes(byte[] bytes)
writeBytes in interface IDataOutputbytes - the bytespublic void writeBytes(byte[] bytes,
int offset)
writeBytes in interface IDataOutputbytes - the bytesoffset - offset in bytes to start writing frompublic void writeBytes(byte[] bytes,
int offset,
int length)
writeBytes in interface IDataOutputbytes - the bytesoffset - offset in bytes to start writing fromlength - number of bytes to writepublic void writeDouble(double value)
writeDouble in interface IDataOutputvalue - the valuepublic void writeFloat(float value)
writeFloat in interface IDataOutputvalue - the valuepublic void writeInt(int value)
writeInt in interface IDataOutputvalue - the valuepublic void writeMultiByte(String value, String encoding)
writeMultiByte in interface IDataOutputvalue - the stringencoding - the character setpublic void writeObject(Object value)
writeObject in interface IDataOutputvalue - the objectpublic void writeShort(short value)
writeShort in interface IDataOutputvalue - the valuepublic void writeUTF(String value)
writeUTF in interface IDataOutputvalue - the stringpublic void writeUTFBytes(String value)
IDataInput.readUTFBytes(int) must be used to load it.writeUTFBytes in interface IDataOutputvalue - the stringpublic void writeUnsignedInt(long value)
writeUnsignedInt in interface IDataOutputvalue - the valueCopyright © 2005–2017 Red5. All rights reserved.