org.red5.io.amf3
Class DataInput

java.lang.Object
  extended by org.red5.io.amf3.DataInput
All Implemented Interfaces:
IDataInput

public class DataInput
extends Object
implements IDataInput

Implementation of the IDataInput interface. Can be used to load an IExternalizable object.

Author:
The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de)

Constructor Summary
protected DataInput(Input input, Deserializer deserializer)
          Create a new DataInput.
 
Method Summary
 ByteOrder getEndian()
          Return the byteorder used when loading values.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataInput

protected DataInput(Input input,
                    Deserializer deserializer)
Create a new DataInput.

Parameters:
input - input to use
deserializer - the deserializer to use
Method Detail

getEndian

public ByteOrder getEndian()
Return the byteorder used when loading values.

Specified by:
getEndian in interface IDataInput
Returns:
the byteorder

setEndian

public void setEndian(ByteOrder endian)
Set the byteorder to use when loading values.

Specified by:
setEndian in interface IDataInput
Parameters:
endian - the byteorder to use

readBoolean

public boolean readBoolean()
Read boolean value.

Specified by:
readBoolean in interface IDataInput
Returns:
the value

readByte

public byte readByte()
Read signed single byte value.

Specified by:
readByte in interface IDataInput
Returns:
the value

readBytes

public void readBytes(byte[] bytes)
Read list of bytes.

Specified by:
readBytes in interface IDataInput
Parameters:
bytes - destination for read bytes

readBytes

public void readBytes(byte[] bytes,
                      int offset)
Read list of bytes to given offset.

Specified by:
readBytes in interface IDataInput
Parameters:
bytes - destination for read bytes
offset - offset in destination to write to

readBytes

public void readBytes(byte[] bytes,
                      int offset,
                      int length)
Read given number of bytes to given offset.

Specified by:
readBytes in interface IDataInput
Parameters:
bytes - destination for read bytes
offset - offset in destination to write to
length - number of bytes to read

readDouble

public double readDouble()
Read double-precision floating point value.

Specified by:
readDouble in interface IDataInput
Returns:
the value

readFloat

public float readFloat()
Read single-precision floating point value.

Specified by:
readFloat in interface IDataInput
Returns:
the value

readInt

public int readInt()
Read signed integer value.

Specified by:
readInt in interface IDataInput
Returns:
the value

readMultiByte

public String readMultiByte(int length,
                            String charSet)
Read multibyte string.

Specified by:
readMultiByte in interface IDataInput
Parameters:
length - length of string to read
charSet - character set of string to read
Returns:
the string

readObject

public Object readObject()
Read arbitrary object.

Specified by:
readObject in interface IDataInput
Returns:
the object

readShort

public short readShort()
Read signed short value.

Specified by:
readShort in interface IDataInput
Returns:
the value

readUnsignedByte

public int readUnsignedByte()
Read unsigned single byte value.

Specified by:
readUnsignedByte in interface IDataInput
Returns:
the value

readUnsignedInt

public long readUnsignedInt()
Read unsigned integer value.

Specified by:
readUnsignedInt in interface IDataInput
Returns:
the value

readUnsignedShort

public int readUnsignedShort()
Read unsigned short value.

Specified by:
readUnsignedShort in interface IDataInput
Returns:
the value

readUTF

public String readUTF()
Read UTF-8 encoded string.

Specified by:
readUTF in interface IDataInput
Returns:
the string

readUTFBytes

public String readUTFBytes(int length)
Read UTF-8 encoded string with given length.

Specified by:
readUTFBytes in interface IDataInput
Parameters:
length - the length of the string
Returns:
the string


Copyright © 2006-2012 The Red5 Project