Class BufferUtils

java.lang.Object
org.red5.io.utils.BufferUtils

public class BufferUtils extends Object
Buffer Utility class which reads/writes integers to the input/output buffer
Author:
The Red5 Project, Luke Hubbard, Codegent Ltd (luke@codegent.com), Andy Shaules (bowljoman@hotmail.com)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final byte[]
    consumeBytes(byte[] in, int numBytesMax)
    Consumes bytes from an input buffer and returns them in an output buffer.
    static final int
    put(org.apache.mina.core.buffer.IoBuffer out, org.apache.mina.core.buffer.IoBuffer in, int numBytesMax)
    Puts an input buffer in an output buffer and returns number of bytes written.
    static int
    readMediumInt(org.apache.mina.core.buffer.IoBuffer in)
    Reads a Medium Int to the in buffer
    static int
    readUnsignedMediumInt(org.apache.mina.core.buffer.IoBuffer in)
    Reads an unsigned Medium Int from the in buffer
    static void
    writeMediumInt(org.apache.mina.core.buffer.IoBuffer out, int value)
    Writes a Medium Int to the output buffer

    Methods inherited from class java.lang.Object

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

    • log

      private static org.slf4j.Logger log
  • Constructor Details

    • BufferUtils

      public BufferUtils()
  • Method Details

    • writeMediumInt

      public static void writeMediumInt(org.apache.mina.core.buffer.IoBuffer out, int value)
      Writes a Medium Int to the output buffer
      Parameters:
      out - Container to write to
      value - Integer to write
    • readUnsignedMediumInt

      public static int readUnsignedMediumInt(org.apache.mina.core.buffer.IoBuffer in)
      Reads an unsigned Medium Int from the in buffer
      Parameters:
      in - Source
      Returns:
      int Integer value
    • readMediumInt

      public static int readMediumInt(org.apache.mina.core.buffer.IoBuffer in)
      Reads a Medium Int to the in buffer
      Parameters:
      in - Source
      Returns:
      int Medium int
    • put

      public static final int put(org.apache.mina.core.buffer.IoBuffer out, org.apache.mina.core.buffer.IoBuffer in, int numBytesMax)
      Puts an input buffer in an output buffer and returns number of bytes written.
      Parameters:
      out - Output buffer
      in - Input buffer
      numBytesMax - Number of bytes max
      Returns:
      int Number of bytes written
    • consumeBytes

      public static final byte[] consumeBytes(byte[] in, int numBytesMax)
      Consumes bytes from an input buffer and returns them in an output buffer.
      Parameters:
      in - Input byte array
      numBytesMax - Number of bytes max
      Returns:
      out Output byte array