ds.ov2.util
Class Misc_host

java.lang.Object
  extended by ds.ov2.util.Misc_host

public class Misc_host
extends Object

Miscellaneous methods needed only in host driver code.

CPP Preprocessing
This class needs no cpp preprocessing.
Execution Environment:
host
Author:
Hendrik Tews
Version:
$Revision: 1.18 $
Last Commit:
$Date: 2009-05-19 14:59:53 $ by $Author: tews $

Constructor Summary
protected Misc_host()
          Static class, object creation disabled.
 
Method Summary
static byte[] byte_array_from_long(long l)
          Convert a long into a big-endian byte array.
static void gc_sleep(int m)
          Collect garbage and sleep.
static long long_from_byte_array(byte[] buf)
          Convert a big-endian byte array into a long value.
static void sleep(int m)
          Sleep for m milliseconds.
static String to_byte_hex_string(byte[] data)
          Converts a byte array into a hex string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Misc_host

protected Misc_host()
Static class, object creation disabled.

Method Detail

byte_array_from_long

public static byte[] byte_array_from_long(long l)
Convert a long into a big-endian byte array.

Parameters:
l - long to convert
Returns:
byte array of length 8 containing the bytes of l in big-endian format

long_from_byte_array

public static long long_from_byte_array(byte[] buf)
Convert a big-endian byte array into a long value.

Parameters:
buf - big-endian byte array
Returns:
equivalent long value
Throws:
IlleagalArgumentException - if the length of buf is different from 8

to_byte_hex_string

public static String to_byte_hex_string(byte[] data)
Converts a byte array into a hex string. The string looks like 23EA.4F11...

Parameters:
data - array to convert
Returns:
hex string

sleep

public static void sleep(int m)
Sleep for m milliseconds. Does not throw InterruptedException in contrast to Thread.sleep.

Parameters:
m - milliseconds to sleep

gc_sleep

public static void gc_sleep(int m)
Collect garbage and sleep. Return immediately (without GC) if the argument m is 0.

Parameters:
m - milliseconds to sleep