com.imagero.uio.bio.content
Class FileCachedInputStreamContent

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

public class FileCachedInputStreamContent
extends Content

Date: 05.01.2008


Constructor Summary
FileCachedInputStreamContent(java.io.InputStream in, java.io.File tmp)
           
 
Method Summary
 boolean canReload()
          Determine if data may be reloaded or not.
 void close()
          close stream
protected  void finalize()
           
 long length()
          Get stream length.
 int load(long offset, int bpos, byte[] buffer)
          Load stream content to specified buffer
 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
load
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileCachedInputStreamContent

public FileCachedInputStreamContent(java.io.InputStream in,
                                    java.io.File tmp)
                             throws java.io.IOException
Method Detail

load

public int load(long offset,
                int bpos,
                byte[] buffer)
         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
bpos - buffer position
buffer - byte array
Returns:
how much bytes were loaded
Throws:
java.io.IOException

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

close

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

Specified by:
close in class Content

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class Content
Throws:
java.lang.Throwable

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.

writable

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