org.jmol.util
Class BinaryDocument

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

public class BinaryDocument
extends java.lang.Object


Field Summary
protected  boolean isBigEndian
           
protected  boolean isRandom
           
(package private)  long nBytes
           
(package private)  java.io.OutputStream os
           
protected  java.io.DataInputStream stream
           
 
Constructor Summary
BinaryDocument()
           
BinaryDocument(java.io.BufferedInputStream bis)
           
 
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()
           
 java.lang.String readString(int nChar)
           
 int readUnsignedShort()
           
 void seek(long offset)
           
 void setIsBigEndian(boolean TF)
           
 void setOutputStream(java.io.OutputStream os, Viewer viewer, double privateKey)
           
 void setRandom(boolean TF)
           
 void setStream(java.io.BufferedInputStream bis, boolean isBigEndian)
           
 void setStream(java.io.DataInputStream stream)
           
static int swapBytes(int n)
           
static short swapBytes(short n)
           
 void writeBytes(byte[] b)
           
 void writeBytes(byte[] b, int off, int n)
           
 void writeInt(int i)
           
 void writeLong(long b)
           
 void writeShort(short i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

protected java.io.DataInputStream stream

isRandom

protected boolean isRandom

isBigEndian

protected boolean isBigEndian

nBytes

long nBytes

os

java.io.OutputStream os
Constructor Detail

BinaryDocument

public BinaryDocument()

BinaryDocument

public BinaryDocument(java.io.BufferedInputStream bis)
Method Detail

close

public void close()

setStream

public void setStream(java.io.BufferedInputStream bis,
                      boolean isBigEndian)

setIsBigEndian

public void setIsBigEndian(boolean TF)

setStream

public void setStream(java.io.DataInputStream stream)

setRandom

public void setRandom(boolean TF)

readByte

public byte readByte()
              throws java.lang.Exception
Throws:
java.lang.Exception

ioReadByte

private byte ioReadByte()
                 throws java.lang.Exception
Throws:
java.lang.Exception

readByteArray

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

readByteArray

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

ioRead

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

writeBytes

public void writeBytes(byte[] b)
                throws java.lang.Exception
Throws:
java.lang.Exception

writeBytes

public void writeBytes(byte[] b,
                       int off,
                       int n)
                throws java.lang.Exception
Throws:
java.lang.Exception

readString

public java.lang.String readString(int nChar)
                            throws java.lang.Exception
Throws:
java.lang.Exception

readShort

public short readShort()
                throws java.lang.Exception
Throws:
java.lang.Exception

ioReadShort

private short ioReadShort()
                   throws java.lang.Exception
Throws:
java.lang.Exception

writeShort

public void writeShort(short i)
                throws java.lang.Exception
Throws:
java.lang.Exception

readInt

public int readInt()
            throws java.lang.Exception
Throws:
java.lang.Exception

ioReadInt

private int ioReadInt()
               throws java.lang.Exception
Throws:
java.lang.Exception

writeInt

public void writeInt(int i)
              throws java.lang.Exception
Throws:
java.lang.Exception

swapBytes

public static int swapBytes(int n)

swapBytes

public static short swapBytes(short n)

readUnsignedShort

public int readUnsignedShort()
                      throws java.lang.Exception
Throws:
java.lang.Exception

readLong

public long readLong()
              throws java.lang.Exception
Throws:
java.lang.Exception

ioReadLong

private long ioReadLong()
                 throws java.lang.Exception
Throws:
java.lang.Exception

writeLong

public void writeLong(long b)
               throws java.lang.Exception
Throws:
java.lang.Exception

readFloat

public float readFloat()
                throws java.lang.Exception
Throws:
java.lang.Exception

ioReadFloat

private float ioReadFloat()
                   throws java.lang.Exception
Throws:
java.lang.Exception

readDouble

public double readDouble()
                  throws java.lang.Exception
Throws:
java.lang.Exception

ioReadDouble

private double ioReadDouble()
                     throws java.lang.Exception
Throws:
java.lang.Exception

readLEInt

private int readLEInt()
               throws java.lang.Exception
Throws:
java.lang.Exception

readLELong

private long readLELong()
                 throws java.lang.Exception
Throws:
java.lang.Exception

seek

public void seek(long offset)

getPosition

public long getPosition()

setOutputStream

public void setOutputStream(java.io.OutputStream os,
                            Viewer viewer,
                            double privateKey)