it.unimi.di.mg4j.index.remote
Class RemoteInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by it.unimi.di.mg4j.index.remote.RemoteInputStream
All Implemented Interfaces:
RepositionableStream, Closeable

public class RemoteInputStream
extends InputStream
implements RepositionableStream

A client class that connects to an IndexServer and exposes a remote InputStream locally.

Author:
Alessandro Arrabito

Nested Class Summary
static class RemoteInputStream.ServerThread
           
 
Constructor Summary
RemoteInputStream(SocketAddress address)
           
RemoteInputStream(SocketAddress address, byte serverCommand)
          Creates a new client input stream using a given socket address.
 
Method Summary
 int available()
           
 void close()
           
 long position()
           
 void position(long newPosition)
           
 int read()
           
 int read(byte[] array, int offset, int length)
           
 long skip(long toSkip)
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteInputStream

public RemoteInputStream(SocketAddress address,
                         byte serverCommand)
                  throws IOException
Creates a new client input stream using a given socket address.

Parameters:
address - the address of the index server.
Throws:
IOException

RemoteInputStream

public RemoteInputStream(SocketAddress address)
                  throws IOException
Throws:
IOException
Method Detail

available

public int available()
              throws IOException
Overrides:
available in class InputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

read

public int read(byte[] array,
                int offset,
                int length)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

skip

public long skip(long toSkip)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

position

public void position(long newPosition)
              throws IOException
Specified by:
position in interface RepositionableStream
Throws:
IOException

position

public long position()
              throws IOException
Specified by:
position in interface RepositionableStream
Throws:
IOException