Multivalent API

phelps.io
Class RandomAccessDataBE

java.lang.Object
  extended by phelps.io.RandomAccessDataBE
All Implemented Interfaces:
com.pt.io.RandomAccess

public class RandomAccessDataBE
extends java.lang.Object
implements com.pt.io.RandomAccess

Wrapper around a RandomAccess that provides read/write of multibyte quantities, big endian.

Version:
$Revision$ $Date$
See Also:
RandomAccessDataLE

Field Summary
 
Fields inherited from interface com.pt.io.RandomAccess
DEVNULL
 
Constructor Summary
RandomAccessDataBE(com.pt.io.RandomAccess ra)
           
 
Method Summary
 void close()
           
 long getFilePointer()
           
 long length()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
           
 int readShort()
           
 int readUnsignedShort()
           
 void seek(long pos)
           
 int skipBytes(int n)
           
 void slice(long start, long length)
          Restricts reads to a slice of file, from start to start + length - 1.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeInt(int v)
           
 void writeShort(int v)
           
 void writeString16(java.lang.String s)
          Writes each character in string as 16-bits / 2-bytes.
 void writeString8(java.lang.String s)
          Writes low eight bits of each character in string -- high 8 bits are ignored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomAccessDataBE

public RandomAccessDataBE(com.pt.io.RandomAccess ra)
Method Detail

seek

public void seek(long pos)
          throws java.io.IOException
Specified by:
seek in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

getFilePointer

public long getFilePointer()
                    throws java.io.IOException
Specified by:
getFilePointer in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Specified by:
length in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

skipBytes

public int skipBytes(int n)
              throws java.io.IOException
Specified by:
skipBytes in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Specified by:
read in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Specified by:
read in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Specified by:
read in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

readFully

public void readFully(byte[] b)
               throws java.io.IOException
Specified by:
readFully in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
Specified by:
readFully in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Specified by:
write in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

writeString8

public void writeString8(java.lang.String s)
                  throws java.io.IOException
Description copied from interface: com.pt.io.RandomAccess
Writes low eight bits of each character in string -- high 8 bits are ignored.

Specified by:
writeString8 in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

writeString16

public void writeString16(java.lang.String s)
                   throws java.io.IOException
Description copied from interface: com.pt.io.RandomAccess
Writes each character in string as 16-bits / 2-bytes.

Specified by:
writeString16 in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Throws:
java.io.IOException

readShort

public int readShort()
              throws java.io.IOException
Throws:
java.io.IOException

readUnsignedShort

public int readUnsignedShort()
                      throws java.io.IOException
Throws:
java.io.IOException

writeInt

public void writeInt(int v)
              throws java.io.IOException
Throws:
java.io.IOException

writeShort

public void writeShort(int v)
                throws java.io.IOException
Throws:
java.io.IOException

slice

public void slice(long start,
                  long length)
           throws java.io.IOException
Description copied from interface: com.pt.io.RandomAccess
Restricts reads to a slice of file, from start to start + length - 1. While the slice is set, all file operations including RandomAccess.seek(long) and RandomAccess.getFilePointer() are relative to start, and RandomAccess.length() is set to the passed length. Subsequent slices are relative to the original file, not other slices. Remove the slice by invoking with slice(0, Long.MAX_VALUE).

Specified by:
slice in interface com.pt.io.RandomAccess
Throws:
java.io.IOException

Multivalent API