|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjwo.landserf.process.io.FileIO
Superclass of all file IO classes. Stores the last error that might have been generated if problem reading or writing a file. Also contains convenience methods for reading and writing binary integers, doubles and floating points from input streams and random access files. Keeps track of a file pointer and byte order.
Field Summary | |
static int |
BIG_ENDIAN
Indicates 'big endian' or Motorola byte ordering. |
protected static int |
bitsPerValue
Bits per value (likely to be 8, 16, 32, or 64) |
protected static int |
byteOrder
Byte order for binary files. |
protected static String |
errorMessage
Last error message or null if no errors. |
protected static long |
filePointer
Keeps track of read position in binary file. |
static int |
GATHER_INFO
Indicates file should be scanned for without loading data. |
protected static int |
lineNumber
Keeps track of line number in text file. |
static int |
LITTLE_ENDIAN
Indicates 'little endian' or Intel byte ordering. |
static int |
LOAD_ALL
Indicates all data should be loaded when reading a file |
static int |
LOAD_SELECTED
Indicates only selected data should be loaded when reading a file. |
protected static float |
nullCode
Value used to indicate null or missing values. |
protected static boolean |
substituteNull
Indicates whether or not to substitute nulls for selected values. |
protected static boolean |
useMultiplier
Indicates whether or not to scale z values by the multiplier. |
protected static float |
zMultiplier
Multiplier used for scaling z values. |
Constructor Summary | |
FileIO()
There should be no need to call the constructor explicitly since all methods are static. |
Method Summary | |
static String |
getErrorMessage()
Reports the last error message, or null if last file operation was sucessful. |
protected static byte |
readByte(InputStream is)
Reads in a single byte from the given input stream. |
protected static byte |
readByte(RandomAccessFile raf)
Reads a single byte of data from the given random access file. |
protected static String |
readCharacters(int numChars,
BufferedInputStream inStream)
Reads in a given number of characters from the input stream and returns a text string representing them. |
protected static String |
readCharacters(int numChars,
BufferedReader inFile)
Reads in a given number of characters and returns text string representing them. |
protected static double |
readDouble(InputStream is)
Reads a 64 bit double precision number from the given input stream. |
protected static double |
readDouble(RandomAccessFile raf)
Reads a 64 bit double precision number from the given random access file. |
protected static double |
readDoubleBigEndian(InputStream is)
Reads a 64 bit big endian double precision number from the given input stream. |
protected static double |
readDoubleBigEndian(RandomAccessFile raf)
Reads a 64 bit big endian double precision number from the given random access file. |
protected static double |
readDoubleLittleEndian(InputStream is)
Reads in a little-endian 8-byte double from the given input stream. |
protected static double |
readDoubleLittleEndian(RandomAccessFile raf)
Reads a 64 bit little endian double precision number from the given random access file. |
protected static float |
readFloat(InputStream is)
Reads a 32 bit floating point number from the given input stream. |
protected static float |
readFloat(RandomAccessFile raf)
Reads a 32 bit floating point number from the given random access file. |
protected static float |
readFloatBigEndian(InputStream is)
Reads in a big-endian 4-byte float from the given input stream. |
protected static float |
readFloatBigEndian(RandomAccessFile raf)
Reads a 32 bit big endian floating point number from the given random access file. |
protected static float |
readFloatLittleEndian(InputStream is)
Reads in a little-endian 4-byte float from the given input stream. |
protected static float |
readFloatLittleEndian(RandomAccessFile raf)
Reads a 32 bit little endian floating point number from the given random access file. |
protected static int |
readInt(InputStream is)
Reads a 32 bit unsigned word of data from the given input stream. |
protected static int |
readInt(RandomAccessFile raf)
Reads a 32 bit unsigned word of data from the given random access file. |
protected static int |
readIntBigEndian(InputStream is)
Reads in a big-endian 4-byte integer from the given input stream. |
protected static int |
readIntBigEndian(RandomAccessFile raf)
Reads a 32 bit unsigned big endian word of data from the given random access file. |
protected static int |
readIntLittleEndian(InputStream is)
Reads in a little-endian 4-byte integer from the given input stream. |
protected static int |
readIntLittleEndian(RandomAccessFile raf)
Reads a 32 bit unsigned little endian word of data from the given random access file. |
protected static String |
readNextWord(BufferedReader inFile)
Reads in the next non-whitespace set of characters. |
protected static short |
readShort(InputStream is)
Reads a 16 bit unsigned word of data from the given input stream. |
protected static short |
readShort(RandomAccessFile raf)
Reads a 16 bit unsigned word of data from the given random access file. |
protected static short |
readShortBigEndian(InputStream is)
Reads in a big-endian 2-byte short integer from the given input stream. |
protected static short |
readShortBigEndian(RandomAccessFile raf)
Reads a 16 bit unsigned big endian word of data from the given random access file. |
protected static short |
readShortLittleEndian(InputStream is)
Reads in a little-endian 2-byte short integer from the given input stream. |
protected static short |
readShortLittleEndian(RandomAccessFile raf)
Reads a 16 bit unsigned little endian word of data from the given random access file. |
static void |
reset()
Resets the error message and file pointer to null. |
protected static void |
seek(RandomAccessFile raf,
long numBytes)
Moves the file pointer to the given offset from the start. |
protected static void |
skip(InputStream is,
long numBytes)
Skips the given number of bytes in the input stream. |
protected static void |
skip(RandomAccessFile raf,
int numBytes)
Skips the given number of bytes in the given random access file. |
protected static boolean |
writeByte(byte value,
OutputStream os)
Writes an 8 bit byte of data to the given output stream. |
protected static boolean |
writeCharacters(String text,
OutputStream os)
Writes out the given text as ASCII characters to the given output stream. |
protected static boolean |
writeDouble(double value,
OutputStream os)
Writes a 64 bit double precision value to the given output stream. |
protected static boolean |
writeDoubleBigEndian(double value,
OutputStream os)
Writes a little-endian 8-byte double to the given output stream. |
protected static boolean |
writeDoubleLittleEndian(double value,
OutputStream os)
Writes a little-endian 8-byte double to the given output stream. |
protected static boolean |
writeFloat(float value,
OutputStream os)
Writes a 32 bit float point value to the given output stream. |
protected static boolean |
writeFloatBigEndian(float value,
OutputStream os)
Writes a little-endian 4-byte float to the given output stream. |
protected static boolean |
writeFloatLittleEndian(float value,
OutputStream os)
Writes a little-endian 4-byte float to the given output stream. |
protected static boolean |
writeInt(int value,
OutputStream os)
Writes a 32 bit unsigned word of data to the given output stream. |
protected static boolean |
writeIntBigEndian(int value,
OutputStream os)
Writes a 32 bit unsigned big-endian ('Motorola') word of data to the given output stream. |
protected static boolean |
writeIntLittleEndian(int value,
OutputStream os)
Writes a 32 bit unsigned little-endian ('Intel') word of data to the given output stream. |
protected static boolean |
writeLine(String text,
BufferedWriter outFile)
Writes out a given line of text on its own line to the given buffered writer. |
protected static boolean |
writeShort(short value,
OutputStream os)
Writes a 16 bit unsigned word of data to the given output stream. |
protected static boolean |
writeShortBigEndian(short value,
OutputStream os)
Writes a 16 bit unsigned big-endian ('Motorola') word of data to the given output stream. |
protected static boolean |
writeShortLittleEndian(short value,
OutputStream os)
Writes a 16 bit unsigned little-endian ('Intel') word of data to the given output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static String errorMessage
protected static long filePointer
protected static int lineNumber
protected static int bitsPerValue
protected static int byteOrder
protected static float nullCode
protected static boolean substituteNull
protected static float zMultiplier
protected static boolean useMultiplier
public static final int LOAD_ALL
public static final int LOAD_SELECTED
public static final int GATHER_INFO
public static final int BIG_ENDIAN
public static final int LITTLE_ENDIAN
Constructor Detail |
public FileIO()
Method Detail |
public static void reset()
public static String getErrorMessage()
protected static void skip(InputStream is, long numBytes)
is
- Input stream.numBytes
- Number of 8-bit bytes to skip.protected static void skip(RandomAccessFile raf, int numBytes)
raf
- Random access file to process.numBytes
- Number of 8-bit bytes to skip.protected static void seek(RandomAccessFile raf, long numBytes)
raf
- Random access file to process.numBytes
- Number of bytes from start to move file pointer.protected static byte readByte(InputStream is)
is
- Input stream.
protected static byte readByte(RandomAccessFile raf)
raf
- Random access file to process.
protected static short readShort(RandomAccessFile raf)
raf
- Random access file to process.
protected static short readShort(InputStream is)
is
- Input stream to process.
protected static boolean writeByte(byte value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static boolean writeShort(short value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static boolean writeFloat(float value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static boolean writeDouble(double value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static int readInt(RandomAccessFile raf)
raf
- Random access file to process.
protected static int readInt(InputStream is)
is
- Input stream to process.
protected static boolean writeInt(int value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static float readFloat(RandomAccessFile raf)
raf
- Random access file to process.
protected static float readFloat(InputStream is)
is
- Input stream to process.
protected static double readDouble(RandomAccessFile raf)
raf
- Random access file to process.
protected static double readDouble(InputStream is)
is
- Input stream to process.
protected static short readShortLittleEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static short readShortLittleEndian(InputStream is)
is
- Input stream.
protected static boolean writeShortLittleEndian(short value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static int readIntLittleEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static int readIntLittleEndian(InputStream is)
is
- Input stream.
protected static boolean writeIntLittleEndian(int value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static float readFloatLittleEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static float readFloatLittleEndian(InputStream is)
is
- Input stream.
protected static boolean writeFloatBigEndian(float value, OutputStream os)
value
- Value to write to output stream.os
- Output stream.
protected static boolean writeFloatLittleEndian(float value, OutputStream os)
value
- Value to write to output stream.os
- Output stream.
protected static boolean writeDoubleBigEndian(double value, OutputStream os)
value
- Value to write to output stream.os
- Output stream.
protected static boolean writeDoubleLittleEndian(double value, OutputStream os)
value
- Value to write to output stream.os
- Output stream.
protected static double readDoubleLittleEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static double readDoubleLittleEndian(InputStream is)
is
- Input stream.
protected static short readShortBigEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static short readShortBigEndian(InputStream is)
is
- Input stream.
protected static boolean writeShortBigEndian(short value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static int readIntBigEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static int readIntBigEndian(InputStream is)
is
- Input stream.
protected static boolean writeIntBigEndian(int value, OutputStream os)
value
- Value to write to output stream.os
- Output stream to process.
protected static float readFloatBigEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static float readFloatBigEndian(InputStream is)
is
- Input stream.
protected static double readDoubleBigEndian(RandomAccessFile raf)
raf
- Random access file to process.
protected static double readDoubleBigEndian(InputStream is)
is
- Input stream.
protected static boolean writeLine(String text, BufferedWriter outFile)
text
- Text to write.outFile
- Buffered file writer to receive the text.
protected static String readCharacters(int numChars, BufferedReader inFile)
numChars
- Number of characters to read.inFile
- File from which to read.
protected static String readCharacters(int numChars, BufferedInputStream inStream)
numChars
- Number of characters to read.inStream
- Input stream from which to read.
protected static boolean writeCharacters(String text, OutputStream os)
text
- Text to write.os
- Output stream to use.
protected static String readNextWord(BufferedReader inFile)
inFile
- File from which to read.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |