Class DataOutput

java.lang.Object
org.red5.io.amf3.DataOutput
All Implemented Interfaces:
IDataOutput

public class DataOutput extends Object implements IDataOutput
Implementation of the IDataOutput interface. Can be used to store an IExternalizable object.
Author:
The Red5 Project, Joachim Bauch (jojo@struktur.de)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.apache.mina.core.buffer.IoBuffer
    Raw data of output destination
    private static org.slf4j.Logger
     
    private Output
    The output stream
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Create a new DataOutput.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the byteorder used when storing values.
    void
    Set the byteorder to use when storing values.
    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
    Write arbitrary object.
    void
    writeShort(short value)
    Write signed short value.
    void
    writeUnsignedInt(long value)
    Write unsigned integer value.
    void
    Write UTF-8 encoded string.
    void
    Write UTF-8 encoded string as byte array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static org.slf4j.Logger logger
    • output

      private Output output
      The output stream
    • buffer

      private org.apache.mina.core.buffer.IoBuffer buffer
      Raw data of output destination
  • Constructor Details

    • DataOutput

      protected DataOutput(Output output)
      Create a new DataOutput.
      Parameters:
      output - destination to write to
  • Method Details

    • getEndian

      public ByteOrder getEndian()
      Return the byteorder used when storing values.
      Specified by:
      getEndian in interface IDataOutput
      Returns:
      the byteorder
    • setEndian

      public void setEndian(ByteOrder endian)
      Set the byteorder to use when storing values.
      Specified by:
      setEndian in interface IDataOutput
      Parameters:
      endian - the byteorder to use
    • writeBoolean

      public void writeBoolean(boolean value)
      Write boolean value.
      Specified by:
      writeBoolean in interface IDataOutput
      Parameters:
      value - the value
    • writeByte

      public void writeByte(byte value)
      Write signed byte value.
      Specified by:
      writeByte in interface IDataOutput
      Parameters:
      value - the value
    • writeBytes

      public void writeBytes(byte[] bytes)
      Write multiple bytes.
      Specified by:
      writeBytes in interface IDataOutput
      Parameters:
      bytes - the bytes
    • writeBytes

      public void writeBytes(byte[] bytes, int offset)
      Write multiple bytes from given offset.
      Specified by:
      writeBytes in interface IDataOutput
      Parameters:
      bytes - the bytes
      offset - offset in bytes to start writing from
    • writeBytes

      public void writeBytes(byte[] bytes, int offset, int length)
      Write given number of bytes from given offset.
      Specified by:
      writeBytes in interface IDataOutput
      Parameters:
      bytes - the bytes
      offset - offset in bytes to start writing from
      length - number of bytes to write
    • writeDouble

      public void writeDouble(double value)
      Write double-precision floating point value.
      Specified by:
      writeDouble in interface IDataOutput
      Parameters:
      value - the value
    • writeFloat

      public void writeFloat(float value)
      Write single-precision floating point value.
      Specified by:
      writeFloat in interface IDataOutput
      Parameters:
      value - the value
    • writeInt

      public void writeInt(int value)
      Write signed integer value.
      Specified by:
      writeInt in interface IDataOutput
      Parameters:
      value - the value
    • writeMultiByte

      public void writeMultiByte(String value, String encoding)
      Write string in given character set.
      Specified by:
      writeMultiByte in interface IDataOutput
      Parameters:
      value - the string
      encoding - the character set
    • writeObject

      public void writeObject(Object value)
      Write arbitrary object.
      Specified by:
      writeObject in interface IDataOutput
      Parameters:
      value - the object
    • writeShort

      public void writeShort(short value)
      Write signed short value.
      Specified by:
      writeShort in interface IDataOutput
      Parameters:
      value - the value
    • writeUnsignedInt

      public void writeUnsignedInt(long value)
      Write unsigned integer value.
      Specified by:
      writeUnsignedInt in interface IDataOutput
      Parameters:
      value - the value
    • writeUTF

      public void writeUTF(String value)
      Write UTF-8 encoded string.
      Specified by:
      writeUTF in interface IDataOutput
      Parameters:
      value - the string
    • writeUTFBytes

      public void writeUTFBytes(String value)
      Write UTF-8 encoded string as byte array. This string is stored without informations about its length, so IDataInput.readUTFBytes(int) must be used to load it.
      Specified by:
      writeUTFBytes in interface IDataOutput
      Parameters:
      value - the string