Class DataStoreEntry
java.lang.Object
org.apache.derby.impl.io.vfmem.DataStoreEntry
A data store entry representing either a file or a directory.
If the entry is a directory, it doesn't create a data object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanTells if this entry is a directory or a regular file.private booleanTells if this entry is read-only or not.private final StringThe path of this entry.private booleanTells if the entry has been released or not.private final BlockedByteArrayThe data of the entry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidChecks if this entry has been released.(package private) BlockedByteArrayInputStreamReturns an input stream to read from this entry.(package private) BlockedByteArrayOutputStreamgetOutputStream(boolean append) Returns an output stream to write into this entry.booleanTells if this entry is a directory.booleanTells if this entry is read-only.longlength()Returns the length of this entry.(package private) voidrelease()Relases this entry.voidsetLength(long newLength) Sets the length of this entry.voidMakes this entry read-only.
-
Field Details
-
path
The path of this entry. -
isDir
private final boolean isDirTells if this entry is a directory or a regular file. -
isReadOnly
private boolean isReadOnlyTells if this entry is read-only or not. -
src
The data of the entry. -
released
private volatile boolean releasedTells if the entry has been released or not.
-
-
Constructor Details
-
DataStoreEntry
Creates a new data store entry.- Parameters:
path- the path of the entryisDir- whether the entry is a directory or a regular file
-
-
Method Details
-
isDirectory
public boolean isDirectory()Tells if this entry is a directory.- Returns:
trueif directory,falseotherwise.
-
getInputStream
Returns an input stream to read from this entry.- Returns:
- An
InputStream-object. - Throws:
FileNotFoundException- if this entry is a directory
-
getOutputStream
Returns an output stream to write into this entry.- Parameters:
append- tells whether the entry should be appended or not- Returns:
- An
OutputStream-object. - Throws:
FileNotFoundException- if this entry is a directory, or is read-only
-
length
public long length()Returns the length of this entry.- Returns:
- The length in bytes.
-
setReadOnly
public void setReadOnly()Makes this entry read-only. -
isReadOnly
public boolean isReadOnly()Tells if this entry is read-only.- Returns:
trueis read-only,falseif not.
-
release
void release()Relases this entry. -
setLength
public void setLength(long newLength) Sets the length of this entry.- Parameters:
newLength- the length in number of bytes
-
checkIfReleased
private void checkIfReleased()Checks if this entry has been released.- Throws:
IllegalStateException- if the entry has been released
-