SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.media
Class ArrayIOUtils

java.lang.Object
  extended by net.java.sip.communicator.impl.media.ArrayIOUtils

public class ArrayIOUtils
extends Object

Implements functionality aiding the reading and writing of byte arrays and primitive types such as short.

Author:
Lubomir Marinov

Constructor Summary
ArrayIOUtils()
           
 
Method Summary
static int readInt16(byte[] input, int inputOffset)
          Reads a short integer from a specific series of bytes starting the reading at a specific offset in it.
static short readShort(byte[] input, int inputOffset)
          Reads a short integer from a specific series of bytes starting the reading at a specific offset in it.
static void writeInt16(int input, byte[] output, int outputOffset)
          Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.
static void writeShort(short input, byte[] output, int outputOffset)
          Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayIOUtils

public ArrayIOUtils()
Method Detail

readInt16

public static int readInt16(byte[] input,
                            int inputOffset)
Reads a short integer from a specific series of bytes starting the reading at a specific offset in it. The difference with readShort(byte[], int) is that the read short integer is an int which has been formed by reading two bytes, not a short.

Parameters:
input - the series of bytes to read the short integer from
inputOffset - the offset in input at which the reading of the short integer is to start
Returns:
a short integer in the form of int read from the specified series of bytes starting at the specified offset in it

readShort

public static short readShort(byte[] input,
                              int inputOffset)
Reads a short integer from a specific series of bytes starting the reading at a specific offset in it.

Parameters:
input - the series of bytes to read the short integer from
inputOffset - the offset in input at which the reading of the short integer is to start
Returns:
a short integer in the form of short read from the specified series of bytes starting at the specified offset in it

writeInt16

public static void writeInt16(int input,
                              byte[] output,
                              int outputOffset)
Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it. The difference with writeShort(short, byte[], int) is that the input is an int and just two bytes of it are written.

Parameters:
input - the short integer to be written out as a series of bytes specified as an integer i.e. the value to be converted is contained in only two of the four bytes made available by the integer
output - the output to receive the conversion of the specified short integer to a series of bytes
outputOffset - the offset in output at which the writing of the result of the conversion is to be started

writeShort

public static void writeShort(short input,
                              byte[] output,
                              int outputOffset)
Converts a short integer to a series of bytes and writes the result into a specific output array of bytes starting the writing at a specific offset in it.

Parameters:
input - the short integer to be written out as a series of bytes specified as short
output - the output to receive the conversion of the specified short integer to a series of bytes
outputOffset - the offset in output at which the writing of the result of the conversion is to be started

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.