swishej
Class UReader

java.lang.Object
  |
  +--swishej.UReader

class UReader
extends java.lang.Object
implements Reader

Reader for reading a SWISH-E index file from a byte array which gets filled from a URL.

See Also:
Reader

Field Summary
(package private)  byte[] buffer
          File data buffer.
(package private) static int CHUNKSIZE
          Default expanded chunk size.
(package private)  GZBuf[] gzbufs
          Chunks for managing data.
(package private)  long pos
          Current file position.
(package private)  int total
          Total data size
 
Constructor Summary
(package private) UReader(java.net.URL url)
          Create an index file reader from given URL.
 
Method Summary
 int read(byte[] b)
          Read an array of bytes.
 void seek(long pos)
          Seek to file position.
 long tell()
          Retrieve current file position
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

CHUNKSIZE

static final int CHUNKSIZE
Default expanded chunk size.

buffer

byte[] buffer
File data buffer.

gzbufs

GZBuf[] gzbufs
Chunks for managing data.

total

int total
Total data size

pos

long pos
Current file position.
Constructor Detail

UReader

UReader(java.net.URL url)
  throws java.net.MalformedURLException,
         java.io.IOException
Create an index file reader from given URL. The content of that URL is read into internal buffers, which can later be operated on by the read, seek, and tell methods.
Parameters:
url - URL to fill the buffers from.
Throws:
java.net.MalformedURLException - if the URL is invalid
java.io.IOException - if a read error occurred
Method Detail

read

public int read(byte[] b)
         throws java.io.IOException
Read an array of bytes.
Specified by:
read in interface Reader
Parameters:
b - byte array to be filled by the read
Returns:
number of bytes read
Throws:
java.io.IOException - if an error occurred

seek

public void seek(long pos)
          throws java.io.IOException
Seek to file position.
Specified by:
seek in interface Reader
Parameters:
pos - long position measured from begin of file, must be positive
Throws:
java.io.IOException - if an error occurred

tell

public long tell()
Retrieve current file position
Specified by:
tell in interface Reader
Returns:
current file position


Contact: Christian.Werner@t-online.de