|
|||||||||
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.CharSequenceReadableFile
public class CharSequenceReadableFile
This is a read only ReadableFile
that reads data from a
CharSequence
.
Locking instances of this class returns a NoObjectDummyLock
.
ManualNamedReadableFile
,
ByteArrayReadableFile
Constructor Summary | |
---|---|
CharSequenceReadableFile(CharSequence contents)
Create a readable file on the supplied CharSequence . |
|
CharSequenceReadableFile(CharSequence contents,
Charset cs)
Create a readable file on the supplied CharSequence . |
Method Summary | |
---|---|
long |
getSize()
Get the size of the file (in bytes). |
ReadableByteChannel |
openChannelForRead()
This opens a byte channel on the InputStream returned from
openForRead . |
InputStream |
openForRead()
Opens the 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CharSequenceReadableFile(CharSequence contents)
CharSequence
. Characters
will be decoded using the default Charset
.
contents
- The contents of the file.public CharSequenceReadableFile(CharSequence contents, Charset cs)
CharSequence
. Characters
will be decoded using the provided Charset
.
contents
- The contents of the file.cs
- The charset to decode the character sequence with.Method Detail |
---|
public ReadableByteChannel openChannelForRead()
AbstractReadableFile
InputStream
returned from
openForRead
.
openChannelForRead
in interface ReadableFile
openChannelForRead
in class AbstractReadableFile
ReadableFile.openForRead()
public InputStream openForRead()
ReadableFile
Although a read lock on the file is required for the execution thread
opening the stream, the stream itself is not protected from access by
other threads. It can be protected by wrapping it in a
LockAwareInputStream
.
InputStream
on the file. The stream must be closed by
the caller.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.
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 String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |