com.imagero.uio.bio
Class FixedSizeByteBuffer

java.lang.Object
  extended bycom.imagero.uio.bio.FixedSizeByteBuffer

public class FixedSizeByteBuffer
extends java.lang.Object

This class can be used to read from and write to byte array.


Constructor Summary
FixedSizeByteBuffer(byte[] buf)
           
 
Method Summary
 int availableForReading(BufferPosition position)
           
 int availableForWriting(BufferPosition position)
           
 RandomAccessIO create()
           
 RandomAccessIO create(int offset, int length)
           
 int getCount()
           
 int getPosition(BufferPosition position)
           
 int read(BufferPosition position)
           
 int read(byte[] dest, int offset, int length, BufferPosition position)
           
 int read(char[] dest, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int read(double[] dest, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int read(float[] dest, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int read(int[] dest, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int read(long[] dest, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int read(short[] dest, int offset, int length, boolean bigEndian, BufferPosition position)
           
 void setCount(int count)
           
 long skip(long n, BufferPosition position)
           
 int write(byte[] src, int offset, int length, BufferPosition position)
           
 int write(char[] src, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int write(double[] src, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int write(float[] src, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int write(int[] src, int offset, int length, boolean bigEndian, BufferPosition position)
           
 void write(int b, BufferPosition position)
          write given byte to buffer.
 int write(long[] src, int offset, int length, boolean bigEndian, BufferPosition position)
           
 int write(short[] src, int offset, int length, boolean bigEndian, BufferPosition position)
           
 void writeBuffer(java.io.DataOutput out)
           
 void writeBuffer(java.io.DataOutput out, boolean wholeBuffer)
           
 void writeBuffer(java.io.OutputStream out)
          write whole buffer contents to OutputStream (count is ignored)
 void writeBuffer(java.io.OutputStream out, boolean wholeBuffer)
          write buffer contents to OutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedSizeByteBuffer

public FixedSizeByteBuffer(byte[] buf)
Method Detail

read

public int read(BufferPosition position)

skip

public long skip(long n,
                 BufferPosition position)

availableForReading

public int availableForReading(BufferPosition position)

availableForWriting

public int availableForWriting(BufferPosition position)

read

public int read(byte[] dest,
                int offset,
                int length,
                BufferPosition position)

read

public int read(short[] dest,
                int offset,
                int length,
                boolean bigEndian,
                BufferPosition position)

read

public int read(char[] dest,
                int offset,
                int length,
                boolean bigEndian,
                BufferPosition position)

read

public int read(int[] dest,
                int offset,
                int length,
                boolean bigEndian,
                BufferPosition position)

read

public int read(float[] dest,
                int offset,
                int length,
                boolean bigEndian,
                BufferPosition position)

read

public int read(long[] dest,
                int offset,
                int length,
                boolean bigEndian,
                BufferPosition position)

read

public int read(double[] dest,
                int offset,
                int length,
                boolean bigEndian,
                BufferPosition position)

write

public void write(int b,
                  BufferPosition position)
write given byte to buffer.

Parameters:
b - int to write

getCount

public int getCount()

getPosition

public int getPosition(BufferPosition position)

setCount

public void setCount(int count)

writeBuffer

public void writeBuffer(java.io.OutputStream out,
                        boolean wholeBuffer)
                 throws java.io.IOException
write buffer contents to OutputStream

Parameters:
wholeBuffer - if true then whole buffer is written, otherwise only getCount() bytes are written
Throws:
java.io.IOException

writeBuffer

public void writeBuffer(java.io.DataOutput out,
                        boolean wholeBuffer)
                 throws java.io.IOException
Throws:
java.io.IOException

writeBuffer

public void writeBuffer(java.io.OutputStream out)
                 throws java.io.IOException
write whole buffer contents to OutputStream (count is ignored)

Throws:
java.io.IOException

writeBuffer

public void writeBuffer(java.io.DataOutput out)
                 throws java.io.IOException
Throws:
java.io.IOException

write

public int write(byte[] src,
                 int offset,
                 int length,
                 BufferPosition position)

write

public int write(short[] src,
                 int offset,
                 int length,
                 boolean bigEndian,
                 BufferPosition position)

write

public int write(char[] src,
                 int offset,
                 int length,
                 boolean bigEndian,
                 BufferPosition position)

write

public int write(int[] src,
                 int offset,
                 int length,
                 boolean bigEndian,
                 BufferPosition position)

write

public int write(float[] src,
                 int offset,
                 int length,
                 boolean bigEndian,
                 BufferPosition position)

write

public int write(long[] src,
                 int offset,
                 int length,
                 boolean bigEndian,
                 BufferPosition position)

write

public int write(double[] src,
                 int offset,
                 int length,
                 boolean bigEndian,
                 BufferPosition position)

create

public RandomAccessIO create()

create

public RandomAccessIO create(int offset,
                             int length)