com.imagero.uio.buffer
Class HTTPBufferManager

java.lang.Object
  extended bycom.imagero.uio.buffer.AbstractBufferManager
      extended bycom.imagero.uio.buffer.HTTPBufferManager
All Implemented Interfaces:
BufferManager

public class HTTPBufferManager
extends AbstractBufferManager

currently supported protocols: file and http

See Also:

Date: 12.11.2003 Time: 12:45:21

Field Summary
static int URL_TYPE_FILE
           
static int URL_TYPE_HTTP
           
static int URL_TYPE_UNKNOWN
           
 
Fields inherited from class com.imagero.uio.buffer.AbstractBufferManager
defaultBufferSize
 
Fields inherited from interface com.imagero.uio.buffer.BufferManager
empty
 
Constructor Summary
HTTPBufferManager(java.net.URL url)
          create BufferManager for InputStream (with standard length of 50k)
HTTPBufferManager(java.net.URL url, int dsLength)
          create BufferManager for InputStream
 
Method Summary
 void close()
          Allows to free all possibly used resources
protected  Buffer createBuffer(java.net.URL url, int offset, int dsLength)
           
 byte[] getData(int i)
          get data (as byte array) from i'th Buffer
 int getDataLength(int i)
          get length of i'th Buffer
 long getDataStart(int i)
          get start of i'th Buffer in byte
I assume here that length of each Buffer (except last one) equals to dsLength
 int getIndex(long pos)
          get index of Buffer which contains pos
 long getLength()
          get length of data of all already read Buffer together (may change)
 
Methods inherited from class com.imagero.uio.buffer.AbstractBufferManager
clear, clear, clearImpl, createAccessManager, flush, getCount, getDefaultBufferSize, getEnd, getMaxCache, getStart, setDefaultBufferSize, setDirty, setDirty, setMaxCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_TYPE_UNKNOWN

public static final int URL_TYPE_UNKNOWN
See Also:
Constant Field Values

URL_TYPE_HTTP

public static final int URL_TYPE_HTTP
See Also:
Constant Field Values

URL_TYPE_FILE

public static final int URL_TYPE_FILE
See Also:
Constant Field Values
Constructor Detail

HTTPBufferManager

public HTTPBufferManager(java.net.URL url)
                  throws java.io.IOException
create BufferManager for InputStream (with standard length of 50k)

Parameters:
url - URL
See Also:
HTTPBuffer

HTTPBufferManager

public HTTPBufferManager(java.net.URL url,
                         int dsLength)
                  throws java.io.IOException
create BufferManager for InputStream

Parameters:
dsLength - standard length of one data block of Buffer
url - URL
See Also:
HTTPBuffer
Method Detail

createBuffer

protected Buffer createBuffer(java.net.URL url,
                              int offset,
                              int dsLength)

getData

public byte[] getData(int i)
               throws java.io.IOException
get data (as byte array) from i'th Buffer

Parameters:
i - Buffer index
Returns:
byte array
Throws:
java.io.IOException - if i'th Buffer not exists and couldn't be read from InputStream

getDataLength

public int getDataLength(int i)
get length of i'th Buffer

Parameters:
i - Buffer index
Returns:
dsLength

getIndex

public int getIndex(long pos)
get index of Buffer which contains pos

Parameters:
pos -
Returns:
index of Buffer or -1

getLength

public long getLength()
get length of data of all already read Buffer together (may change)


getDataStart

public long getDataStart(int i)
get start of i'th Buffer in byte
I assume here that length of each Buffer (except last one) equals to dsLength

Parameters:
i -
Returns:
int
                          n-1
dataStart(n) = Σ getDataLength(i)
                          i=0

close

public void close()
Description copied from interface: BufferManager
Allows to free all possibly used resources