|
GeoSoft API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Object | +--FileAccessor
Base class for file accessors (file readers and writers).
Features:
This class is not abstract as a subclass will overload only one of readFile() and writeFile() depending wether it is a reader or a writer class (it can only be one of the two).
There are some convenience methods for actually accessing the files (readLine() and write()), for more detailed access a reader class will use the reader_/binaryReader_ and a writer will use the writer/binaryWriter_ objects.
| Nested Class Summary | |
class |
FileAccessor.DefaultLogger
Dummy logger instance in case none is specified. |
| Constructor Summary | |
FileAccessor(File file)
Create a file accessor without a logger. |
|
FileAccessor(File file,
FileLogger logger)
Create a file accessor for the specified file and with the specified logger instance. |
|
| Method Summary | |
long |
getChecksum()
Return the checksum for this file. |
Object |
readFile()
To be overridden by a file reader class. |
String |
readLine()
Read one line from the file. |
void |
reportProgress()
Force the progress to be reported to the logger. |
void |
setLogger(FileLogger logger)
Set logger. |
void |
skip(long n)
Skip n bytes during read. |
void |
write(String string)
Write a line to the file. |
void |
writeFile(Object object)
To be overridden by a file writer class. |
| Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileAccessor(File file,
FileLogger logger)
file - File to create accessor for.logger - Logger.public FileAccessor(File file)
file - File to create accessor for.| Method Detail |
public void setLogger(FileLogger logger)
logger - File accessor logger.public long getChecksum()
public String readLine()
throws IOException
IOException
public void write(String string)
throws IOException
string - Line to write.
IOException
public void skip(long n)
throws IOException
n - Number of bytes to skip.
IOExceptionpublic void reportProgress()
public Object readFile()
public void writeFile(Object object)
object - Object to write.
|
GeoSoft API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||