Copyright 2011-01-06 Werner Randelshofer

ch.randelshofer.media.binary
Class ByteArrayBinaryModel

java.lang.Object
  extended by ch.randelshofer.media.binary.ByteArrayBinaryModel
All Implemented Interfaces:
BinaryModel

public class ByteArrayBinaryModel
extends java.lang.Object
implements BinaryModel

Model for untyped binary data.

Version:
1.1 2010-04-09 Refactored and renamed from BinaryModel to ByteArrayBinaryModel.
1.0 1999-10-19
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland

Constructor Summary
ByteArrayBinaryModel()
           
ByteArrayBinaryModel(byte[] data)
           
ByteArrayBinaryModel(java.io.InputStream in)
           
 
Method Summary
 void close()
          Closes the model and disposes all resources.
 int getBytes(long offset, int len, byte[] target)
          Gets a sequence of bytes and copies them into the supplied byte array.
 long getLength()
          Returns the total length of the binary data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayBinaryModel

public ByteArrayBinaryModel()

ByteArrayBinaryModel

public ByteArrayBinaryModel(byte[] data)

ByteArrayBinaryModel

public ByteArrayBinaryModel(java.io.InputStream in)
                     throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getLength

public long getLength()
Description copied from interface: BinaryModel
Returns the total length of the binary data.

Specified by:
getLength in interface BinaryModel

getBytes

public int getBytes(long offset,
                    int len,
                    byte[] target)
Gets a sequence of bytes and copies them into the supplied byte array.

Specified by:
getBytes in interface BinaryModel
Parameters:
offset - the starting offset >= 0
len - the number of bytes >= 0 && <= size - offset
target - the target array to copy into
Throws:
java.lang.ArrayIndexOutOfBoundsException - Thrown if the area covered by the arguments is not contained in the model.

close

public void close()
Description copied from interface: BinaryModel
Closes the model and disposes all resources.

Specified by:
close in interface BinaryModel

Copyright 2011-01-06 Werner Randelshofer