oemware.core.util
Class ByteUtils

java.lang.Object
  extended by oemware.core.util.ByteNumberUtils
      extended by oemware.core.util.ByteUtils

public final class ByteUtils
extends ByteNumberUtils

The byte utils. All byte and byte buffer utilities should go here.

Version:
$Id: ByteUtils.java 13 2008-06-15 19:43:04Z oemware $

Constructor Summary
ByteUtils()
           
 
Method Summary
static byte[] appendArray(byte[] buffer1, byte[] buffer2)
          Appends the second array to the first array.
static java.nio.ByteBuffer copyByteBuffer(java.nio.ByteBuffer pBuffer)
          Clone a byte buffer.
static byte[] trimArray(byte[] buffer, int pNum)
          Removes X bytes from the end of the array.
 
Methods inherited from class oemware.core.util.ByteNumberUtils
createInt, createIntB, createUInt, getInt, getLongL, getUByte, getUInt, getUInt, getUShort, getUShortChar, setIntB, setLongL, setUInt, setUShort, setUShortChar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteUtils

public ByteUtils()
Method Detail

copyByteBuffer

public static final java.nio.ByteBuffer copyByteBuffer(java.nio.ByteBuffer pBuffer)
Clone a byte buffer. This doesn't work on direct buffers. The mark isn't passed to the new buffer. The size of the new buffer is based on the limit and not the capacity.

Parameters:
pBuffer - The buffer.
Returns:
The new object.

appendArray

public static final byte[] appendArray(byte[] buffer1,
                                       byte[] buffer2)
Appends the second array to the first array. The buffer1 object is modified to include the buffer2 object.

Parameters:
buffer1 - The first buffer.
buffer2 - The second buffer.
Returns:
The new array.

trimArray

public static final byte[] trimArray(byte[] buffer,
                                     int pNum)
Removes X bytes from the end of the array. This creates a new smaller array.

Parameters:
buffer - The buffer.
pNum - The number of bytes to remove.


Copyright © 2008 Deft Labs - Released under LGPL, Version 3.0