Open SiteSearch 4.1.1
Final

ORG.oclc.ber
Class BufferedBerStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--java.io.BufferedInputStream
                    |
                    +--ORG.oclc.ber.BufferedBerStream

public class BufferedBerStream
extends BufferedInputStream

BufferedBerStream is a class to sequentially read BER records from an InputStream. Here is an example that opens a file, reads all the records and prints each record.

BufferedBerStream berStream = null;
BerString berRec;
//
try { berStream = new BufferedBerStream(new FileInputStream("berfile")); }
catch (FileNotFoundException n) {
System.out.println(n.toString());
return;
}
//
while (true) {
try { berRec = berStream.readBerString(); 
System.out.println(berRec.toString());
}
catch (FileNotFoundException n) {
System.out.println(n.toString());
return;
} catch (EOFException n) {
System.out.println(n.toString());
return;
} catch (IOException n) {
System.out.println(n.toString());
return;
}
}

See Also:
BerString

Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
BufferedBerStream(InputStream in)
          Create a BufferedInputStream ready for reading BerStrings.
BufferedBerStream(InputStream in, int size)
          Create a BufferedInputStream ready for reading BerStrings.
BufferedBerStream(String filename)
          Create a BufferedInputStream ready for reading BerStrings.
BufferedBerStream(String filename, int size)
          Create a BufferedInputStream ready for reading BerStrings.
 
Method Summary
 BerString readBerString()
          Read a BerString from the InputStream.
 
Methods inherited from class java.io.BufferedInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedBerStream

public BufferedBerStream(String filename)
                  throws FileNotFoundException
Create a BufferedInputStream ready for reading BerStrings. The default buffer size is 10000 bytes.
Parameters:
in - filename
Throws:
FileNotFoundException - Creation of BufferedInputStream failed

BufferedBerStream

public BufferedBerStream(InputStream in)
Create a BufferedInputStream ready for reading BerStrings. The default buffer size is 10000 bytes.
Parameters:
in - InputStream

BufferedBerStream

public BufferedBerStream(InputStream in,
                         int size)
Create a BufferedInputStream ready for reading BerStrings.
Parameters:
in - InputStream
int - buffer size

BufferedBerStream

public BufferedBerStream(String filename,
                         int size)
                  throws FileNotFoundException
Create a BufferedInputStream ready for reading BerStrings.
Parameters:
in - filename
int - buffer size
Throws:
FileNotFoundException - Creation of BufferedInputStream failed
Method Detail

readBerString

public BerString readBerString()
                        throws FileNotFoundException,
                               EOFException,
                               IOException
Read a BerString from the InputStream.
Throws:
FileNotFoundException - Creation of BufferedInputStream failed.
EOFException - End of file was reached.
IOException - I/O Error occured while reading file.

Open SiteSearch 4.1.1
Final