|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
FileContents
objects encapsulate the name
and contents of a file. An implementation of this class is
used by the FileOpenService
,
FileSaveService
, and
PersistenceService
.
The FileContents
implementation returned by
PersistenceService.get(java.net.URL)
, FileOpenService
,
and FileSaveService
should never truncate a file
if the maximum file length is set to be less that the current
file length.
FileOpenService
,
FileSaveService
Method Summary | |
boolean |
canRead()
Returns whether the file can be read. |
boolean |
canWrite()
Returns whether the file can be written to. |
java.io.InputStream |
getInputStream()
Gets an InputStream from the file. |
long |
getLength()
Gets the length of the file. |
long |
getMaxLength()
Gets the maximum file length for the file, as set by the creator of this object. |
java.lang.String |
getName()
Gets the file name as a String . |
java.io.OutputStream |
getOutputStream(boolean overwrite)
Gets an OutputStream to the file. |
JNLPRandomAccessFile |
getRandomAccessFile(java.lang.String mode)
Returns a JNLPRandomAccessFile representing a
random access interface to the file's contents. |
long |
setMaxLength(long maxlength)
Sets the maximum file length for the file. |
Method Detail |
public java.lang.String getName() throws java.io.IOException
String
.public java.io.InputStream getInputStream() throws java.io.IOException
InputStream
from the file.public java.io.OutputStream getOutputStream(boolean overwrite) throws java.io.IOException
OutputStream
to the file. A JNLP
client may implement this interface to return an OutputStream
subclass which restricts the amount of data that can be
written to the stream.public long getLength() throws java.io.IOException
public boolean canRead() throws java.io.IOException
public boolean canWrite() throws java.io.IOException
public JNLPRandomAccessFile getRandomAccessFile(java.lang.String mode) throws java.io.IOException
JNLPRandomAccessFile
representing a
random access interface to the file's contents.
The mode argument must either be equal to "r" or "rw",
indicating the file is to be opened for input only or for both
input and output, respectively. An IllegalArgumentException
will be thrown if the mode is not equal to "r" or "rw".mode
- the access mode.public long getMaxLength() throws java.io.IOException
public long setMaxLength(long maxlength) throws java.io.IOException
maxlength
- the requested new maximum file length.
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |