org.jmol.util
Class BinaryDocument

java.lang.Object
  extended by org.jmol.util.BinaryDocument
Direct Known Subclasses:
CompoundDocument

public class BinaryDocument
extends Object


Field Summary
protected  boolean isBigEndian
           
protected  boolean isRandom
           
(package private)  long nBytes
           
(package private)  OutputStream os
           
protected  DataInputStream stream
           
 
Constructor Summary
BinaryDocument()
           
 
Method Summary
 void close()
           
 long getPosition()
           
private  int ioRead(byte[] b, int off, int len)
           
private  byte ioReadByte()
           
private  double ioReadDouble()
           
private  float ioReadFloat()
           
private  int ioReadInt()
           
private  long ioReadLong()
           
private  short ioReadShort()
           
 byte readByte()
           
 void readByteArray(byte[] b)
           
 int readByteArray(byte[] b, int off, int len)
           
 double readDouble()
           
 float readFloat()
           
 int readInt()
           
private  int readLEInt()
           
private  long readLELong()
           
 long readLong()
           
 short readShort()
           
 String readString(int nChar)
           
 int readUnsignedShort()
           
 void seek(long offset)
           
 void setIsBigEndian(boolean TF)
           
 void setOutputStream(OutputStream os)
           
 void setRandom(boolean TF)
           
 void setStream(BufferedInputStream bis, boolean isBigEndian)
           
 void setStream(DataInputStream stream)
           
static int swapBytes(int n)
           
static short swapBytes(short n)
           
private  void writeInt(int i)
           
private  void writeLong(long b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

protected DataInputStream stream

isRandom

protected boolean isRandom

isBigEndian

protected boolean isBigEndian

nBytes

long nBytes

os

OutputStream os
Constructor Detail

BinaryDocument

public BinaryDocument()
Method Detail

close

public void close()

setStream

public void setStream(BufferedInputStream bis,
                      boolean isBigEndian)

setIsBigEndian

public void setIsBigEndian(boolean TF)

setStream

public void setStream(DataInputStream stream)

setRandom

public void setRandom(boolean TF)

readByte

public byte readByte()
              throws Exception
Throws:
Exception

ioReadByte

private byte ioReadByte()
                 throws Exception
Throws:
Exception

readByteArray

public void readByteArray(byte[] b)
                   throws Exception
Throws:
Exception

readByteArray

public int readByteArray(byte[] b,
                         int off,
                         int len)
                  throws Exception
Throws:
Exception

ioRead

private int ioRead(byte[] b,
                   int off,
                   int len)
            throws Exception
Throws:
Exception

readString

public String readString(int nChar)
                  throws Exception
Throws:
Exception

readShort

public short readShort()
                throws Exception
Throws:
Exception

ioReadShort

private short ioReadShort()
                   throws Exception
Throws:
Exception

readInt

public int readInt()
            throws Exception
Throws:
Exception

ioReadInt

private int ioReadInt()
               throws Exception
Throws:
Exception

writeInt

private void writeInt(int i)
               throws Exception
Throws:
Exception

swapBytes

public static int swapBytes(int n)

swapBytes

public static short swapBytes(short n)

readUnsignedShort

public int readUnsignedShort()
                      throws Exception
Throws:
Exception

readLong

public long readLong()
              throws Exception
Throws:
Exception

ioReadLong

private long ioReadLong()
                 throws Exception
Throws:
Exception

writeLong

private void writeLong(long b)
                throws Exception
Throws:
Exception

readFloat

public float readFloat()
                throws Exception
Throws:
Exception

ioReadFloat

private float ioReadFloat()
                   throws Exception
Throws:
Exception

readDouble

public double readDouble()
                  throws Exception
Throws:
Exception

ioReadDouble

private double ioReadDouble()
                     throws Exception
Throws:
Exception

readLEInt

private int readLEInt()
               throws Exception
Throws:
Exception

readLELong

private long readLELong()
                 throws Exception
Throws:
Exception

seek

public void seek(long offset)

getPosition

public long getPosition()

setOutputStream

public void setOutputStream(OutputStream os)