Class DataInput

java.lang.Object
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, Joachim Bauch (jojo@struktur.de)
  • Field Details

    • input

      private Input input
      The input stream.
    • buffer

      private org.apache.mina.core.buffer.IoBuffer buffer
      Raw data of input source.
  • Constructor Details

    • DataInput

      protected DataInput(Input input)
      Create a new DataInput.
      Parameters:
      input - input to use
  • Method Details

    • 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