Package gov.usgs.earthquake.product.io
Class BinaryIO
java.lang.Object
gov.usgs.earthquake.product.io.BinaryIO
Class to read and write Binary streams
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbyte[]readBytes(InputStream in) Reads a byte array from the InputStreamreadDate(InputStream in) Reads date from the InputStreamprotected voidreadFully(byte[] buffer, InputStream in) Function used by other read funcs Reads from input stream until buffer is fullintreadInt(InputStream in) Reads 4 bytes from the InputStreamlongreadLong(InputStream in) Reads 8 bytes from the InputStreamvoidreadStream(long length, InputStream in, OutputStream out) Function called by previous readStream Used to read whole streamvoidreadStream(InputStream in, OutputStream out) Reads streamReads string from the InputStreamreadString(InputStream in, int maxLength) Reads string with a max length from the InputStreamvoidwriteBytes(byte[] toWrite, OutputStream out) Writes an array of bytes to the OutputStream buffervoidwriteDate(Date toWrite, OutputStream out) Writes a date to the OutputStream buffervoidwriteInt(int in, OutputStream out) Writes an int to the OutputStream buffervoidwriteLong(long in, OutputStream out) Writes an long to the OutputStream buffervoidwriteStream(long length, InputStream in, OutputStream out) Writes a long to the OutputStream buffervoidwriteString(String toWrite, OutputStream out) Writes a string to the OutputStream buffer
- 
Constructor Details- 
BinaryIOpublic BinaryIO()
 
- 
- 
Method Details- 
writeIntWrites an int to the OutputStream buffer- Parameters:
- in- an int to write
- out- the OutputStream
- Throws:
- IOException- if IO error occurs
 
- 
writeLongWrites an long to the OutputStream buffer- Parameters:
- in- an long to write
- out- the OutputStream
- Throws:
- IOException- if IO error occurs
 
- 
writeBytesWrites an array of bytes to the OutputStream buffer- Parameters:
- toWrite- an array of bytes to write
- out- the OutputStream
- Throws:
- IOException- if IO error occurs
 
- 
writeStringWrites a string to the OutputStream buffer- Parameters:
- toWrite- a string to write
- out- the OutputStream
- Throws:
- IOException- if IO error occurs
 
- 
writeDateWrites a date to the OutputStream buffer- Parameters:
- toWrite- a date to write
- out- the OutputStream
- Throws:
- IOException- if IO error occurs
 
- 
writeStreamWrites a long to the OutputStream buffer- Parameters:
- length- a long to write
- in- an input stream
- out- the OutputStream
- Throws:
- IOException- if IO error occurs
 
- 
readIntReads 4 bytes from the InputStream- Parameters:
- in- InputStream
- Returns:
- an int
- Throws:
- IOException- if IO Error occurs
 
- 
readLongReads 8 bytes from the InputStream- Parameters:
- in- InputStream
- Returns:
- a long
- Throws:
- IOException- if IO Error occurs
 
- 
readBytesReads a byte array from the InputStream- Parameters:
- in- InputStream
- Returns:
- Byte[]
- Throws:
- IOException- if IO Error occurs
 
- 
readStringReads string from the InputStream- Parameters:
- in- InputStream
- Returns:
- a string
- Throws:
- IOException- if IO Error occurs
 
- 
readStringReads string with a max length from the InputStream- Parameters:
- in- InputStream
- maxLength- of string
- Returns:
- an string
- Throws:
- IOException- if IO Error occurs
 
- 
readDateReads date from the InputStream- Parameters:
- in- InputStream
- Returns:
- a date
- Throws:
- IOException- if IO Error occurs
 
- 
readStreamReads stream- Parameters:
- in- InputStream
- out- OutputStream
- Throws:
- IOException- if IO Error occurs
 
- 
readStreamFunction called by previous readStream Used to read whole stream- Parameters:
- length- length of inputstream
- in- input stream
- out- output stream
- Throws:
- IOException- if io error occurs
 
- 
readFullyFunction used by other read funcs Reads from input stream until buffer is full- Parameters:
- buffer- byte[]
- in- inputstream
- Throws:
- IOException- if IO error occurs
 
 
-