byteblock
Class ByteBlockRectangularWindow

java.lang.Object
  |
  +--byteblock.ByteBlockWindow
        |
        +--byteblock.ByteBlockRectangularWindow
Direct Known Subclasses:
ByteBlockMaskedWindow

public class ByteBlockRectangularWindow
extends ByteBlockWindow

A rectangular window into a byte block.


Field Summary
protected  int baseStartIndex
           
protected  int numCols
           
protected  int numRows
           
 
Fields inherited from class byteblock.ByteBlockWindow
baseBlock
 
Constructor Summary
ByteBlockRectangularWindow(ByteBlock block)
          Create a window based on an existing base block, with the same number of rows and columns.
ByteBlockRectangularWindow(int baseStartIndex, int numRows, int numCols, ByteBlock block)
          Create a window into the specified base block, with specified number of rows and columns, and starting at specified index of the base block.
 
Method Summary
 void clearBytes()
          Set all bytes in window to 0x00.
 void clearBytes(int startIndex, int endIndex)
          Set all bytes in window from (and including) startByte to (and excluding) endByte to 0x00.
 byte[] getBytes()
          Return the sequence of bytes in the window.
 byte[] getBytes(int startIndex, int endIndex)
          Return the sequence of bytes in the window between the specified indices.
 int getSize()
          Return the total number of bytes in the window (= numRows * numCols).
 java.lang.String toHexString()
          Return a String representing the bytes in the window, without spaces between bytes.
 java.lang.String toHexString(int startIndex, int endIndex)
          Return a String representing the bytes in the window between the specified indices, without spaces between bytes.
 java.lang.String toString()
          Return a String representing the bytes in the window, with spaces between pairs of hex digits.
 java.lang.String toString(int startIndex, int endIndex)
          Return a String representing the bytes in the window between the specified indices, with spaces between pairs of hex digits.
 void writeBytes(byte[] byteString)
          Write the sequence of bytes supplied into the window, starting from the beginning.
 void writeBytes(int startIndex, byte[] byteString)
          Write a sequence of bytes into the window, starting at the specified index.
 
Methods inherited from class byteblock.ByteBlockWindow
getHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numRows

protected int numRows

numCols

protected int numCols

baseStartIndex

protected int baseStartIndex
Constructor Detail

ByteBlockRectangularWindow

public ByteBlockRectangularWindow(ByteBlock block)
Create a window based on an existing base block, with the same number of rows and columns.

ByteBlockRectangularWindow

public ByteBlockRectangularWindow(int baseStartIndex,
                                  int numRows,
                                  int numCols,
                                  ByteBlock block)
Create a window into the specified base block, with specified number of rows and columns, and starting at specified index of the base block. Note that the number of columns need not be less than the number of columns in the base block, and a rectangular window can extend beyond the base block's boundary, "wrapping" into the other side.
Method Detail

getSize

public int getSize()
Return the total number of bytes in the window (= numRows * numCols).
Overrides:
getSize in class ByteBlockWindow

getBytes

public byte[] getBytes()
Return the sequence of bytes in the window.
Overrides:
getBytes in class ByteBlockWindow

getBytes

public byte[] getBytes(int startIndex,
                       int endIndex)
Return the sequence of bytes in the window between the specified indices.

clearBytes

public void clearBytes()
Set all bytes in window to 0x00.
Overrides:
clearBytes in class ByteBlockWindow

clearBytes

public void clearBytes(int startIndex,
                       int endIndex)
Set all bytes in window from (and including) startByte to (and excluding) endByte to 0x00.

writeBytes

public void writeBytes(byte[] byteString)
Write the sequence of bytes supplied into the window, starting from the beginning. Note that this automatically clears all the other bytes in the case in which the number of bytes supplied is less than the total number of bytes in the window.
Overrides:
writeBytes in class ByteBlockWindow

writeBytes

public void writeBytes(int startIndex,
                       byte[] byteString)
Write a sequence of bytes into the window, starting at the specified index. Note that this automatically clears all the other bytes in the window.

toString

public java.lang.String toString()
Return a String representing the bytes in the window, with spaces between pairs of hex digits.
Overrides:
toString in class ByteBlockWindow

toString

public java.lang.String toString(int startIndex,
                                 int endIndex)
Return a String representing the bytes in the window between the specified indices, with spaces between pairs of hex digits.

toHexString

public java.lang.String toHexString()
Return a String representing the bytes in the window, without spaces between bytes.
Overrides:
toHexString in class ByteBlockWindow

toHexString

public java.lang.String toHexString(int startIndex,
                                    int endIndex)
Return a String representing the bytes in the window between the specified indices, without spaces between bytes.