|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadWritableFile
This is a combination of the ReadableFile
, WritableFile
and
RandomlyAccessibleFile
interfaces. I.e., the most of that which makes
a file a file, except for its entity properties such as its location in a
file system.
This interface can be used to represent a file when its location is not important.
Method Summary | |
---|---|
long |
copy(OutputStream os)
Dump the file contents to the stream. |
long |
copy(WritableByteChannel c)
Copy the file's contents to the WritableByteChannel . |
long |
getSizeNoLocking()
Get an approximate size of the file without having to lock it. |
void |
replaceContents(ReadWritableFile f)
Replace the contents of this file with the contents of the supplied file and then delete the supplied file. |
Methods inherited from interface org.entityfs.ReadableFile |
---|
getDataSize, getSize, openChannelForRead, openForRead |
Methods inherited from interface org.entityfs.WritableFile |
---|
openChannelForAppend, openChannelForWrite, openForAppend, openForWrite |
Methods inherited from interface org.entityfs.RandomlyAccessibleFile |
---|
openForRandomAccess |
Methods inherited from interface org.entityfs.lock.ReadLockable |
---|
getReadLock, isReadLockedByCurrentThread, lockForReading |
Methods inherited from interface org.entityfs.lock.WriteLockable |
---|
getWriteLock, isWriteLockedByCurrentThread, lockForWriting |
Methods inherited from interface org.entityfs.Deletable |
---|
delete, isDeleted |
Method Detail |
---|
void replaceContents(ReadWritableFile f) throws WriteLockRequiredException, AccessDeniedException, ReadOnlyException, IllegalArgumentException
f
over to this file, which makes the entire operation quick and not
requiring any extra disk space.
If both files support metadata, this file's metadata is replaced with
that of f
.
f
- The file whose contents are to be moved to this file. f
is deleted by this method.
WriteLockRequiredException
- If the client does not have write
locks for this file, this file's parent directory, f
and f
's parent directory.
AccessDeniedException
- If the client does not have write access to
this file, this file's parent directory, f
or f
's parent
directory.
ReadOnlyException
- If this file or f
is read only.
IllegalArgumentException
- If the supplied file is not in the same
file system as this file.f
and f
's parent directory.f
and f
's parent directory.long getSizeNoLocking()
0
is returned.ReadableFile.getSize()
long copy(OutputStream os) throws ReadLockRequiredException, AccessDeniedException
os
- The stream the file contents are written to. The stream is not
closed after writing, that must be done by the caller.
ReadLockRequiredException
- If the client does not have a read lock
for the file.
AccessDeniedException
- If the client does not have read access to
the file.long copy(WritableByteChannel c) throws ReadLockRequiredException, AccessDeniedException
WritableByteChannel
.
c
- The WritableByteChannel
. The channel is not closed by
this method.
ReadLockRequiredException
- If the client does not have a read lock
for the file.
AccessDeniedException
- If the client does not have read access to
the file.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |