public class REXXFile extends Object
| Constructor and Description |
|---|
REXXFile(String filename)
Creates a REXXFile instance that represents the file
whose pathname is given as the path argument.
|
REXXFile(String filename,
boolean create)
Creates a REXXFile instance that represents the file
whose pathname is given as the path argument.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
close()
Closes the file.
|
String |
date()
Gets the last modified date of the file.
|
void |
dispose()
Disposes of the file (makes sure it's closed).
|
boolean |
exists()
Tests if the file exists.
|
long |
fileSize()
Checks the number of bytes that remain to be read.
|
String |
getException()
Gets the current file exception after an error.
|
String |
getPath()
Gets the real path for the file.
|
boolean |
isOpen()
Checks if the file is opened.
|
boolean |
isReadable()
Checks if the file is readable.
|
boolean |
isReadWrite()
Flag indicating the file is read- and writable.
|
boolean |
isWritable()
Checks if the file is writable.
|
long |
leftOver()
Returns the number of bytes after the current position to the
end of the file.
|
boolean |
open()
Opens the file for Read and/or Write
depending on R/W status of REXXFile.
|
boolean |
open(boolean create)
Opens the file.
|
long |
position()
Gets the current position in the stream.
|
String |
read(int length,
long position)
Read and codepage convert data from stream.
|
String |
readLine(long pos,
long count)
Reads a line from the stream without the line separator.
|
boolean |
seek(long position)
Seek a position in a file.
|
void |
setException(String e)
Sets a string as the error for the exception.
|
long |
write(String data,
long position)
Writes a string of data to the requested position.
|
int |
writeLine(String data,
long line)
Writes a line a text to the stream.
|
public REXXFile(String filename, boolean create)
filename - the file name and path.create - if file does not exist.public REXXFile(String filename)
filename - the file name and path.public void dispose()
public boolean exists()
public boolean isOpen()
public boolean isWritable()
public boolean isReadable()
public boolean isReadWrite()
public String getPath()
public boolean open(boolean create)
create - if does not exist.public boolean open()
public boolean close()
public long fileSize()
public int writeLine(String data, long line)
public String readLine(long pos, long count) throws IOException
Parameters:
pos line in file to read, or 0 for current line. count Number of lines to read, 0=no read, 1 read one line.
IOExceptionpublic String read(int length, long position) throws IOException
length - length to read (0 for a seek to position).position - offset to start reading data from stream.IOExceptionpublic boolean seek(long position)
throws IOException
position - offset to seek to (position<0 for current position).IOExceptionpublic long position()
throws IOException
IOExceptionpublic long leftOver()
public long write(String data, long position) throws IOException
IOExceptionpublic String date()
public void setException(String e)
public String getException()
Phantom® and NetPhantom® are registered trademarks of Nexum Technologies SARL.
© Copyright Nexum Technologies SARL, 2011. All rights reserved.