util
Class Util

java.lang.Object
  extended by util.Util

public class Util
extends java.lang.Object

Various static utility methods.

Version:
$Id: Util.java,v 1.1.1.1 2009/01/13 03:43:28 zahorjan Exp $

Constructor Summary
Util()
           
 
Method Summary
static int BAToInt(byte[] buf)
          Convert byte[0]...buf[3] to integer.
static int BAToInt(byte[] buf, int offset)
          Convert byte[offset]...byte[offset+3] to integer.
static int BAToShort(byte[] buf)
          Convert buf[0] buf[1] to int in range 0..65535
static int BAToShort(byte[] buf, int offset)
          Convert buf[offset] buf[offset+1] to int in range 0..65535
static java.lang.String InetAddrToHost(java.net.InetSocketAddress addr)
           
static void IntToBA(int val, byte[] buf)
          Write integer into buf[0]...buf[3]
static void IntToBA(int val, byte[] buf, int offset)
          Write integer into buf[offset]...buf[offset+3]
static void main(java.lang.String[] args)
          Unit test.
static void ShortToBA(int val, byte[] buf)
          Write low order 16-bits of val into buf[0] buf[1]
static void ShortToBA(int val, byte[] buf, int offset)
          Write low-order 16-bits of val into buf[offset] buf[offset+1]
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

InetAddrToHost

public static java.lang.String InetAddrToHost(java.net.InetSocketAddress addr)
                                       throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

IntToBA

public static void IntToBA(int val,
                           byte[] buf,
                           int offset)
Write integer into buf[offset]...buf[offset+3]


IntToBA

public static void IntToBA(int val,
                           byte[] buf)
Write integer into buf[0]...buf[3]


BAToInt

public static int BAToInt(byte[] buf,
                          int offset)
Convert byte[offset]...byte[offset+3] to integer.


BAToInt

public static int BAToInt(byte[] buf)
Convert byte[0]...buf[3] to integer.


ShortToBA

public static void ShortToBA(int val,
                             byte[] buf,
                             int offset)
Write low-order 16-bits of val into buf[offset] buf[offset+1]


ShortToBA

public static void ShortToBA(int val,
                             byte[] buf)
Write low order 16-bits of val into buf[0] buf[1]


BAToShort

public static int BAToShort(byte[] buf,
                            int offset)
Convert buf[offset] buf[offset+1] to int in range 0..65535


BAToShort

public static int BAToShort(byte[] buf)
Convert buf[0] buf[1] to int in range 0..65535


main

public static void main(java.lang.String[] args)
Unit test.