|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.entityfs.util.base.AbstractReadableFile org.entityfs.util.FileReadableFile
public class FileReadableFile
This is a ReadableFile
that encapsulates a File
.
The locking methods return a NoObjectDummyLock
.
FileWritableFile
Constructor Summary | |
---|---|
FileReadableFile(File f)
|
Method Summary | |
---|---|
boolean |
equals(Object o)
|
File |
getFile()
Get the encapsulated File object. |
String |
getName()
Get the name. |
long |
getSize()
Get the size of the file (in bytes). |
int |
hashCode()
|
FileChannel |
openChannelForRead()
This opens a byte channel on the file. |
InputStream |
openForRead()
Open this file for reading. |
String |
toString()
|
Methods inherited from class org.entityfs.util.base.AbstractReadableFile |
---|
getDataSize, getReadLock, isReadLockedByCurrentThread, lockForReading |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.entityfs.ReadableFile |
---|
getDataSize |
Methods inherited from interface org.entityfs.lock.ReadLockable |
---|
getReadLock, isReadLockedByCurrentThread, lockForReading |
Constructor Detail |
---|
public FileReadableFile(File f)
Method Detail |
---|
public File getFile()
File
object.
File
object.public String getName()
Named
/
.
getName
in interface Named
public InputStream openForRead() throws WrappedIOException
openForRead
in interface ReadableFile
InputStream
on the file. The stream must be closed by
the caller.
WrappedIOException
- If the underlying URL throws an IOException
.public FileChannel openChannelForRead() throws WrappedIOException
openChannelForRead
in interface ReadableFile
openChannelForRead
in class AbstractReadableFile
WrappedIOException
ReadableFile.openForRead()
public long getSize() throws ReadLockRequiredException, AccessDeniedException
ReadableFile
Note: Most, but not all, implementations know their sizes. If an implementation does not know its size beforehand, this method will be slow since it has to calculate the file size when it is called.
Implementation note: If the size of the backing file is not known,
the
StreamUtil.getSizeOfDataInStream(InputStream, int)
method can be used to calculate it.
getSize
in interface ReadableFile
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.ReadableFile.getDataSize()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |