ikrs.httpd
Interface Resource

All Known Subinterfaces:
DirectoryResource
All Known Implementing Classes:
AbstractDirectoryResource, AbstractResource, BufferedResource, ByteArrayResource, DefaultDirectoryResource, FileResource, InterruptableResource, PHPDirectoryResource, ProcessableResource, RangedResource, ReplacingResource, ResourceDelegation

public interface Resource


Method Summary
 boolean close()
          Closes this resource.
 HypertextAccessFile getHypertextAccessFile()
          Get the resource's hypertext access file settings.
 java.io.InputStream getInputStream()
          Get the input stream from this resource.
 long getLength()
          This method returns the *actual* length of the underlying resource.
 ResourceMetaData getMetaData()
          Get the meta data for this resource.
 java.io.OutputStream getOutputStream()
          Get the output stream to this resource.
 java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock getReadLock()
          This method returns the read lock for this resource.
 java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock getWriteLock()
          This method returns the write lock for this resource.
 boolean isOpen()
          This method determines if this resource was alerady opened or not.
 boolean isReadOnly()
          This method returns true if the underlying resource is read-only (in general).
 void open(boolean readOnly)
          This method opens the underlying resource.
 

Method Detail

getMetaData

ResourceMetaData getMetaData()
Get the meta data for this resource.


getHypertextAccessFile

HypertextAccessFile getHypertextAccessFile()
Get the resource's hypertext access file settings. If the resource has no hypertext access settings available the method may return null.


getReadLock

java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock getReadLock()
This method returns the read lock for this resource.


getWriteLock

java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock getWriteLock()
This method returns the write lock for this resource.


open

void open(boolean readOnly)
          throws java.io.IOException
This method opens the underlying resource. Don't forget to close.

Parameters:
readOnly - if set to true, the resource will be opned in read-only mode.
Throws:
ReadOnlyException - If the underlying resource is read-only in general.
java.io.IOException - If any other IO error occurs.
See Also:
isReadOnly()

isOpen

boolean isOpen()
               throws java.io.IOException
This method determines if this resource was alerady opened or not.

Throws:
java.io.IOException - If any IO error occurs.

isReadOnly

boolean isReadOnly()
                   throws java.io.IOException
This method returns true if the underlying resource is read-only (in general).

Throws:
java.io.IOException - If any IO error occurs.

getLength

long getLength()
               throws java.io.IOException
This method returns the *actual* length of the underlying resource. This length will be used in the HTTP header fields to specify the transaction length. During read-process (you used the locks, didn't you?) the length MUST NOT change.

Returns:
the length of the resource's data in bytes.
Throws:
java.io.IOException - If any IO error occurs.

getOutputStream

java.io.OutputStream getOutputStream()
                                     throws ReadOnlyException,
                                            java.io.IOException
Get the output stream to this resource.

Throws:
ReadOnlyException - If this resource was opened with the read-only flag set.
java.io.IOException - If any other IO error occurs.

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get the input stream from this resource.

Throws:
java.io.IOException - If any IO error occurs.

close

boolean close()
              throws java.io.IOException
Closes this resource.

Returns:
false if the resource was already closed, false otherwise.
Throws:
java.io.IOException