|
|||||||||
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 ikrs.httpd.resource.RangedResource
public class RangedResource
The RangedResource class is a wrapper class that allows to 'cut off' some bytes at the beginning and/or at the end of an existing resource. The amount of bytes to be dropped is specified by a ContentRange instance passed to the constructor. Actually the RangedResource uses a custom getInputStream() replacement with a nested ReadLimit- (to drop trailing bytes) and BytePosition-InputStream (to drop leading bytes).
Constructor Summary | |
---|---|
RangedResource(Resource resource,
ContentRange range,
HTTPHandler handler,
CustomLogger logger)
|
Method Summary | |
---|---|
java.io.InputStream |
getInputStream()
Get the input stream from this resource. |
long |
getLength()
This method returns the *actual* length of the underlying resource. |
static void |
main(java.lang.String[] argv)
This method is for testing only. |
void |
open(boolean readOnly)
This method opens the underlying resource. |
Methods inherited from class ikrs.httpd.resource.ResourceDelegation |
---|
close, getCoreResource, getHypertextAccessFile, getMetaData, getOutputStream, getReadLock, getWriteLock, isOpen, isReadOnly |
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 RangedResource(Resource resource, ContentRange range, HTTPHandler handler, CustomLogger logger) throws java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
java.lang.NullPointerException
java.lang.IndexOutOfBoundsException
Method Detail |
---|
public void open(boolean readOnly) throws java.io.IOException
open
in interface Resource
open
in class ResourceDelegation
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.ResourceDelegation.isReadOnly()
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface Resource
getInputStream
in class ResourceDelegation
java.io.IOException
- If any IO error occurs.public long getLength() throws java.io.IOException
getLength
in interface Resource
getLength
in class ResourceDelegation
java.io.IOException
- If any IO error occurs.public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |