|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.entityfs.impl.impl.adapter.AbstractRWEntityAdapter<RamFileSystemAdapter,RamDirectoryAdapter>
org.entityfs.ram.AbstractRamEntityAdapter
org.entityfs.ram.RamFileAdapter
public final class RamFileAdapter
| Constructor Summary | |
|---|---|
RamFileAdapter(RamFileSystemAdapter fs,
RamDirectoryAdapter parent,
String name)
|
|
| Method Summary | |
|---|---|
void |
copyTo(OutputStream os)
Copy the file contents to the output stream. |
void |
copyTo(WritableByteChannel wbc)
Copy the file contents to the writable channel. |
void |
delete()
Override to leave back segments to the size guard |
long |
getDataSize()
Get the file's data size in bytes. |
EntityType |
getEntityType()
Get the EntityType for this entity. |
T |
getFileSystemAdapter()
Get the FileSystemAdapter for the file system where the entity
is. |
long |
getSize()
Get the file size in bytes. |
void |
init()
This implementation does nothing. |
ScatteringByteChannel |
openChannelForRead()
|
GatheringByteChannel |
openChannelForWrite(boolean append)
|
RandomAccess |
openForRandomAccess(RandomAccessMode mode)
|
InputStream |
openForRead()
Open an InputStream on the file. |
OutputStream |
openForWrite(boolean append)
Open the file for writing. |
int |
read(long pos)
|
int |
read(long pos,
byte[] barr)
|
int |
read(long pos,
byte[] barr,
int off,
int len)
Same behavior as InputStream.read |
int |
read(long pos,
ByteBuffer bb)
|
void |
replaceContents(FileAdapter fa)
Replace the contents of this file adapter with the contents of the supplied file adapter. |
void |
setLength(long l)
|
String |
toString()
|
void |
write(byte[] barr)
|
void |
write(byte[] barr,
int off,
int len)
Same contract as OutputStream.write |
int |
write(ByteBuffer src)
|
void |
write(int b)
|
void |
writeAt(long pos,
byte[] barr)
|
void |
writeAt(long pos,
byte[] barr,
int off,
int len)
|
int |
writeAt(long pos,
ByteBuffer src)
|
void |
writeAt(long pos,
int b)
|
| Methods inherited from class org.entityfs.ram.AbstractRamEntityAdapter |
|---|
canRead, canWrite, create, exists, getLastModified, rename, setLastModified |
| Methods inherited from class org.entityfs.impl.impl.adapter.AbstractRWEntityAdapter |
|---|
getName, getParent, setName, setParent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.entityfs.impl.adapter.EntityAdapter |
|---|
canRead, canWrite, create, exists, getFileSystemAdapter, getLastModified, getName, getParent, init, rename, setLastModified |
| Constructor Detail |
|---|
public RamFileAdapter(RamFileSystemAdapter fs,
RamDirectoryAdapter parent,
String name)
| Method Detail |
|---|
public long getSize()
FileAdapter
getSize in interface FileAdapterpublic long getDataSize()
FileAdapter
getDataSize in interface FileAdapterpublic InputStream openForRead()
FileAdapterInputStream on the file.
openForRead in interface FileAdapterInputStream for the file.public OutputStream openForWrite(boolean append)
FileAdapter
See WritableFile.openForWrite() and
WritableFile.openForAppend() for the subtle and the
not-so-subtle differences between the append and overwrite modes.
openForWrite in interface FileAdapterappend - If true, new data will be appended to existing data
in the file. If false, existing data will be overwritten.public ScatteringByteChannel openChannelForRead()
openChannelForRead in interface FileAdapterpublic GatheringByteChannel openChannelForWrite(boolean append)
openChannelForWrite in interface FileAdapterpublic RandomAccess openForRandomAccess(RandomAccessMode mode)
openForRandomAccess in interface FileAdapterpublic void copyTo(OutputStream os)
FileAdapter
copyTo in interface FileAdapteros - The output stream. The stream is not closed by this method.public void copyTo(WritableByteChannel wbc)
FileAdapter
copyTo in interface FileAdapterwbc - The writable channel. The channel is not closed by this method.public EntityType getEntityType()
EntityAdapterEntityType for this entity.
getEntityType in interface EntityAdapterEntityType for this entity.public int read(long pos)
public int read(long pos,
byte[] barr,
int off,
int len)
public int read(long pos,
byte[] barr)
public int read(long pos,
ByteBuffer bb)
public void write(int b)
public void write(byte[] barr,
int off,
int len)
barr - off - len - public void write(byte[] barr)
public void writeAt(long pos,
int b)
public void writeAt(long pos,
byte[] barr,
int off,
int len)
public void writeAt(long pos,
byte[] barr)
public int write(ByteBuffer src)
public int writeAt(long pos,
ByteBuffer src)
public void setLength(long l)
public void delete()
delete in interface EntityAdapterdelete in class AbstractRamEntityAdapterpublic void replaceContents(FileAdapter fa)
FileAdapterImplementations must make sure that the file's last modification time is updated.
replaceContents in interface FileAdapterfa - The file adapter whose contents this file adapter's contents
should be replaced with. fa is guaranteed to be in the
same file system as this file adapter.public String toString()
toString in class Objectpublic void init()
init in interface EntityAdapterpublic T getFileSystemAdapter()
EntityAdapterFileSystemAdapter for the file system where the entity
is.
getFileSystemAdapter in interface EntityAdapterFileSystemAdapter.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||