com.isti.util.bytehandler
Class ByteHandler

java.lang.Object
  extended by com.isti.util.bytehandler.ByteHandler

public class ByteHandler
extends java.lang.Object

Title:

Description:

Copyright: Copyright (c) 1999

Company: ISTI


Constructor Summary
ByteHandler()
           
 
Method Summary
 int byte2int(byte[] bytes)
           
 long byte2long(byte[] bytes)
           
static short byte2short(byte[] bytes)
           
 void compareBytes(ByteHandler bh2)
           
 byte[] double2byte(double mylong)
           
 java.lang.Class getClassType(char type)
          return the class type for type defined by the char "type"
 int getSize()
          returns the number of bytes that we will end up having in the byte array
 java.lang.Object getValue(int position)
           
 boolean initValue(int position)
          put the tmp object into the vector at the desired location.
 boolean initVector()
           
 byte[] int2byte(int myint)
          should always return a 4 element byte array
 byte[] long2byte(long mylong)
          should always return a 4 element byte array
static void main(java.lang.String[] args)
           
 boolean parseByteAr(byte[] ba)
           
 boolean parseValue(int position)
           
 void printBytes()
           
 void setFormat(java.lang.String sformat)
          changing the format forces a clearing of the vector of items.
 boolean setValue(int position, java.lang.Object tmp)
          put the tmp object into the vector at the desired location.
 byte[] short2byte(short myshort)
          should always return a 2 element byte array
 byte[] toByteArray()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteHandler

public ByteHandler()
Method Detail

parseByteAr

public boolean parseByteAr(byte[] ba)
                    throws java.lang.Exception
Throws:
java.lang.Exception

parseValue

public boolean parseValue(int position)
                   throws java.lang.Exception
Throws:
java.lang.Exception

setValue

public boolean setValue(int position,
                        java.lang.Object tmp)
                 throws java.lang.ClassCastException
put the tmp object into the vector at the desired location. returns true if it is allowed.

Parameters:
tmp - Object
position - int
Returns:
boolean
Throws:
java.lang.ClassCastException

initVector

public boolean initVector()
                   throws java.lang.ClassCastException
Throws:
java.lang.ClassCastException

initValue

public boolean initValue(int position)
                  throws java.lang.ClassCastException
put the tmp object into the vector at the desired location. returns true if it is allowed.

Parameters:
tmp - Object
position - int
Returns:
boolean
Throws:
java.lang.ClassCastException

getValue

public java.lang.Object getValue(int position)
                          throws java.lang.ClassCastException
Throws:
java.lang.ClassCastException

getClassType

public java.lang.Class getClassType(char type)
                             throws java.lang.ClassCastException
return the class type for type defined by the char "type"

Parameters:
type - char
Returns:
Class
Throws:
java.lang.ClassCastException

getSize

public int getSize()
            throws java.lang.ClassCastException
returns the number of bytes that we will end up having in the byte array

Throws:
java.lang.ClassCastException

setFormat

public void setFormat(java.lang.String sformat)
               throws java.lang.ClassCastException
changing the format forces a clearing of the vector of items.

Parameters:
format - String
Throws:
java.lang.ClassCastException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toByteArray

public byte[] toByteArray()
                   throws java.lang.Exception
Throws:
java.lang.Exception

byte2short

public static short byte2short(byte[] bytes)
                        throws java.lang.ClassCastException
Throws:
java.lang.ClassCastException

byte2int

public int byte2int(byte[] bytes)

byte2long

public long byte2long(byte[] bytes)

short2byte

public byte[] short2byte(short myshort)
should always return a 2 element byte array

Parameters:
myint - short
Returns:
byte[]

int2byte

public byte[] int2byte(int myint)
should always return a 4 element byte array

Parameters:
myint - int
Returns:
byte[]

long2byte

public byte[] long2byte(long mylong)
should always return a 4 element byte array

Parameters:
myint - int
Returns:
byte[]

double2byte

public byte[] double2byte(double mylong)

printBytes

public void printBytes()
                throws java.lang.Exception
Throws:
java.lang.Exception

compareBytes

public void compareBytes(ByteHandler bh2)
                  throws java.lang.Exception
Throws:
java.lang.Exception

main

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