|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GCFFile
Interface for native peer of a file handle
Method Summary | |
---|---|
void |
close()
Close file associated with this handler. |
void |
closeForRead()
Closes for reading the file that was open by openForRead method. |
void |
closeForReadWrite()
Closes the file for both reading and writing. |
void |
closeForWrite()
Closes for writing the file that was open by openForWrite method. |
void |
connect(String rootName,
String fileName)
Connect file handler to the abstract file target. |
void |
create()
Create file corresponding to this file handler. |
void |
delete()
Deletes the file or directory associated with this handler. |
boolean |
exists()
Check is file or directory corresponding to this filehandler exists. |
long |
fileSize()
Determines the size of a file on the file system. |
void |
flush()
Forces any buffered output bytes to be written out. |
String |
illegalFileNameChars()
Returns a string that contains all characters forbidden for the use on the given platform except "/" (forward slash) which is always considered illegal. |
boolean |
isDirectory()
Check is file corresponding to this filehandler exists and is a directory. |
void |
openForRead()
Open the file for reading, on the underlying file system. |
void |
openForWrite()
Open the file for writing, on the underlying file system. |
void |
positionForWrite(long offset)
Sets the location for the next write operation. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into
an array of bytes, blocks until at least one byte is available. |
int |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to this output stream. |
Method Detail |
---|
void connect(String rootName, String fileName)
rootName
- The name of the root directory.fileName
- Full path to the file to be handled by this handler.
IllegalArgumentException
- if filename contains characters
not allowed by the file system. This check should not involve
any actual access to the filesystem.void openForRead() throws IOException
IOException
- if file is directory, file does not exists,
if file is already open for read or other
I/O error occursvoid closeForRead() throws IOException
IOException
- if file is directory, file does not exists or other
I/O error occursvoid openForWrite() throws IOException
IOException
- if file is directory, file does not exists,
i if file is already open for write or other
I/O error occursvoid closeForWrite() throws IOException
IOException
- if file is directory, file does not exists or other
I/O error occursvoid closeForReadWrite() throws IOException
IOException
- if file is directory, file does not exists or other
I/O error occursvoid create() throws IOException
IOException
- if invoked on the existing file or unexpected error
occurs.boolean exists()
boolean isDirectory()
void delete() throws IOException
IOException
- If the target is a directory and it is not empty,
the connection target does not exist or is unaccessible, or
an unspecified error occurs preventing deletion of the target.long fileSize() throws IOException
flush()
on any open output streams to the file
prior to invoking this method to ensure accurate results.
IOException
- if the method is invoked on a directory.int read(byte[] b, int off, int len) throws IOException
len
bytes of data from the input stream into
an array of bytes, blocks until at least one byte is available.
b
- the buffer into which the data is read.off
- the start offset in array b
at which the data is written.len
- the maximum number of bytes to read.
-1
if there is no more data because the end of
the stream has been reached.
IOException
- if an I/O error occurs.int write(byte[] b, int off, int len) throws IOException
len
bytes from the specified byte array
starting at offset off
to this output stream.
Polling the native code is done here to allow for simple asynchronous native code to be written. Not all implementations work this way (they block in the native code) but the same Java code works for both.
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.
IOException
- if an I/O error occurs. In particular,
an IOException
is thrown if the output
stream is closed.void flush() throws IOException
flush
is
that calling it is an indication that, if any bytes previously
written that have been buffered by the connection,
should immediately be written to their intended destination.
The flush
method of ConnectionBaseAdapter
does nothing.
IOException
- if an I/O error occurs.void positionForWrite(long offset) throws IOException
offset
- location for next write
IOException
- if an error occursString illegalFileNameChars()
void close() throws IOException
IOException
- if I/O error occurs
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |