public abstract class EmblCDROMIndexReader extends Object
EmblCDROMIndexReader is an abstract class whose
 concrete subclasses read EMBL CD-ROM format indices from an
 underlying InputStream. This format is used by the
 EMBOSS package for database indexing (see programs dbiblast,
 dbifasta, dbiflat and dbigcg). Indexing produces four binary files
 with a simple format:
Internally EMBOSS checks for Big-endian architechtures and
 switches the byte order to Little-endian. This means trouble if you
 try to read the file using DataInputStream, but at
 least the binaries are consistent across architechtures. This class
 carries out the necessary conversion.
The EMBL CD-ROM format stores the date in 4 bytes. One byte is unused (the first one), leaving one byte for the day, one for the month and one (!) for the year.
For further information see the EMBOSS documentation, or for a full description, the source code of the dbi programs and the Ajax library.
| Modifier and Type | Field and Description | 
|---|---|
protected InputStream | 
input  | 
protected org.biojava.bio.seq.db.emblcd.RecordParser | 
recParser  | 
protected StringBuffer | 
sb  | 
| Constructor and Description | 
|---|
EmblCDROMIndexReader(InputStream input)
Creates a new  
EmblCDROMIndexReader instance. | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
close closes the underlying
 InputStream. | 
String | 
readDBDate()
readDBDate reads the date from the index
 header. | 
String | 
readDBName()
readDBName returns the database name from the
 index header. | 
String | 
readDBRelease()
readDBRelease returns the database release from
 the index header. | 
long | 
readFileLength()
readFileLength returns the file length in bytes
 (stored within the file's header by the indexing program). | 
byte[] | 
readRawRecord()
readRawRecord returns the raw bytes of a single
 record from the index. | 
abstract Object[] | 
readRecord()
readRecord returns an array of objects parsed from
 a single record. | 
long | 
readRecordCount()
readRecordCount returns the number of records in
 the file. | 
int | 
readRecordLength()
readRecordLength returns the record length
 (bytes). | 
protected InputStream input
protected StringBuffer sb
protected org.biojava.bio.seq.db.emblcd.RecordParser recParser
public EmblCDROMIndexReader(InputStream input) throws IOException
EmblCDROMIndexReader instance. A
 BufferedInputStream is probably the most suitable.input - an InputStream.IOException - if an error occurs.public long readFileLength()
readFileLength returns the file length in bytes
 (stored within the file's header by the indexing program). This
 may be called more than once as the value is cached.long.public long readRecordCount()
readRecordCount returns the number of records in
 the file. This may be called more than once as the value is
 cached.long.public int readRecordLength()
readRecordLength returns the record length
 (bytes). This may be called more than once as the value is
 cached.int.public String readDBName()
readDBName returns the database name from the
 index header. This may be called more than once as the value is
 cached.String.public String readDBRelease()
readDBRelease returns the database release from
 the index header. This may be called more than once as the
 value is cached.String.public String readDBDate()
readDBDate reads the date from the index
 header. The date is stored in 4 bytes: 0, unused; 1, year; 2,
 month; 3, day. With a 1 byte year it's not very much use and
 I'm not sure that the EMBOSS programs set the value correctly
 anyway.String.public abstract Object[] readRecord() throws IOException
readRecord returns an array of objects parsed from
 a single record. Its content will depend on the type of index
 file. Concrete subclasses must provide an implementation of
 this method.Object [] array.IOException - if an error occurs.public byte[] readRawRecord() throws IOException
readRawRecord returns the raw bytes of a single
 record from the index.byte [] array.IOException - if an error occurs.public void close() throws IOException
close closes the underlying
 InputStream.IOException - if an error occurs.Copyright © 2014 BioJava. All rights reserved.