org.apache.derby.impl.io.vfmem
Class DataStoreEntry

java.lang.Object
  extended by org.apache.derby.impl.io.vfmem.DataStoreEntry

public class DataStoreEntry
extends java.lang.Object

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
private  boolean isDir
          Tells if this entry is a directory or a regular file.
private  boolean isReadOnly
          Tells if this entry is read-only or not.
private  java.lang.String path
          The path of this entry.
private  boolean released
          Tells if the entry has been released or not.
private  BlockedByteArray src
          The data of the entry.
 
Constructor Summary
DataStoreEntry(java.lang.String path, boolean isDir)
          Creates a new data store entry.
 
Method Summary
private  void checkIfReleased()
          Checks if this entry has been released.
(package private)  BlockedByteArrayInputStream getInputStream()
          Returns an input stream to read from this entry.
(package private)  BlockedByteArrayOutputStream getOutputStream(boolean append)
          Returns an output stream to write into this entry.
 boolean isDirectory()
          Tells if this entry is a directory.
 boolean isReadOnly()
          Tells if this entry is read-only.
 long length()
          Returns the length of this entry.
(package private)  void release()
          Relases this entry.
 void setLength(long newLength)
          Sets the length of this entry.
 void setReadOnly()
          Makes this entry read-only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

private final java.lang.String path
The path of this entry.


isDir

private final boolean isDir
Tells if this entry is a directory or a regular file.


isReadOnly

private boolean isReadOnly
Tells if this entry is read-only or not.


src

private final BlockedByteArray src
The data of the entry.


released

private volatile boolean released
Tells if the entry has been released or not.

Constructor Detail

DataStoreEntry

public DataStoreEntry(java.lang.String path,
                      boolean isDir)
Creates a new data store entry.

Parameters:
path - the path of the entry
isDir - whether the entry is a directory or a regular file
Method Detail

isDirectory

public boolean isDirectory()
Tells if this entry is a directory.

Returns:
true if directory, false otherwise.

getInputStream

BlockedByteArrayInputStream getInputStream()
                                     throws java.io.FileNotFoundException
Returns an input stream to read from this entry.

Returns:
An InputStream-object.
Throws:
java.io.FileNotFoundException - if this entry is a directory

getOutputStream

BlockedByteArrayOutputStream getOutputStream(boolean append)
                                       throws java.io.FileNotFoundException
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:
java.io.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:
true is read-only, false if 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:
java.lang.IllegalStateException - if the entry has been released

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.