|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ikrs.httpd.resource.AbstractResource ikrs.httpd.resource.ResourceDelegation
public abstract class ResourceDelegation
The ResourceDelegation is an abstract wrapper class that holds an internal Resource instance. All methods are implemented and just redirect the calls to the internal delegated core instance. This class is meant to be extended and some desired method(s) to be overriden to slightly change its behavior. Example: the RangedResource class overrides the open(...) method and skips some bytes at the beginning.
Constructor Summary | |
---|---|
ResourceDelegation(Resource resource,
HTTPHandler handler,
CustomLogger logger)
|
Method Summary | |
---|---|
boolean |
close()
Closes this resource. |
protected Resource |
getCoreResource()
|
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. |
Methods inherited from class ikrs.httpd.resource.AbstractResource |
---|
getHTTPHandler, getLogger, setHypertextAccessFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceDelegation(Resource resource, HTTPHandler handler, CustomLogger logger)
Method Detail |
---|
protected Resource getCoreResource()
public ResourceMetaData getMetaData()
getMetaData
in interface Resource
getMetaData
in class AbstractResource
public HypertextAccessFile getHypertextAccessFile()
getHypertextAccessFile
in interface Resource
getHypertextAccessFile
in class AbstractResource
public java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock getReadLock()
getReadLock
in interface Resource
getReadLock
in class AbstractResource
public java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock getWriteLock()
getWriteLock
in interface Resource
getWriteLock
in class AbstractResource
public void open(boolean readOnly) throws java.io.IOException
open
in interface Resource
open
in class AbstractResource
readOnly
- if set to true, the resource will be opned in read-only mode.
ReadOnlyException
- If the underlying resource is read-only in general.
java.io.IOException
- If any other IO error occurs.isReadOnly()
public boolean isOpen() throws java.io.IOException
isOpen
in interface Resource
isOpen
in class AbstractResource
java.io.IOException
- If any IO error occurs.public boolean isReadOnly() throws java.io.IOException
isReadOnly
in interface Resource
isReadOnly
in class AbstractResource
java.io.IOException
- If any IO error occurs.public long getLength() throws java.io.IOException
getLength
in interface Resource
getLength
in class AbstractResource
java.io.IOException
- If any IO error occurs.public java.io.OutputStream getOutputStream() throws ReadOnlyException, java.io.IOException
getOutputStream
in interface Resource
getOutputStream
in class AbstractResource
ReadOnlyException
- If this resource was opened with the read-only flag set.
java.io.IOException
- If any other IO error occurs.public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface Resource
getInputStream
in class AbstractResource
java.io.IOException
- If any IO error occurs.public boolean close() throws java.io.IOException
close
in interface Resource
close
in class AbstractResource
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |