com.imagero.uio.bio.content
Class MemoryCachedInputStreamContent

java.lang.Object
  extended bycom.imagero.uio.bio.content.Content
      extended bycom.imagero.uio.bio.content.MemoryCachedInputStreamContent

public class MemoryCachedInputStreamContent
extends Content

Date: 05.01.2008


Constructor Summary
MemoryCachedInputStreamContent(java.io.InputStream in, int chunkSize)
           
 
Method Summary
 boolean canReload()
          Determine if data may be reloaded or not.
 void close()
          close stream
 long length()
          Get stream length.
 int load(long offset, int destOffset, byte[] dest)
          Load stream content to specified buffer
protected  void prepare()
           
 void save(long offset, int bpos, byte[] buffer, int length)
          Save buffer content to stream.
 boolean writable()
           
 
Methods inherited from class com.imagero.uio.bio.content.Content
finalize, load
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryCachedInputStreamContent

public MemoryCachedInputStreamContent(java.io.InputStream in,
                                      int chunkSize)
Method Detail

load

public int load(long offset,
                int destOffset,
                byte[] dest)
         throws java.io.IOException
Description copied from class: Content
Load stream content to specified buffer

Specified by:
load in class Content
Parameters:
offset - stream offset
destOffset - buffer position
dest - byte array
Returns:
how much bytes were loaded
Throws:
java.io.IOException

prepare

protected void prepare()

close

public void close()
Description copied from class: Content
close stream

Specified by:
close in class Content

canReload

public boolean canReload()
Description copied from class: Content
Determine if data may be reloaded or not. For example: data from InputStream cannot be reloaded, however if content uses file or memory based cache then it is possible to reload data.

Specified by:
canReload in class Content
Returns:
true if data can be reloaded.

save

public void save(long offset,
                 int bpos,
                 byte[] buffer,
                 int length)
          throws java.io.IOException
Description copied from class: Content
Save buffer content to stream. Not always supported.

Specified by:
save in class Content
Parameters:
offset - stream offset
bpos - buffer position
buffer - byte array
length - how much bytes should be saved
Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Description copied from class: Content
Get stream length. Not always known.

Specified by:
length in class Content
Returns:
Throws:
java.io.IOException

writable

public boolean writable()
Specified by:
writable in class Content