uk.ac.rdg.resc.jstyx.client
Class CStyxFileInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by uk.ac.rdg.resc.jstyx.client.CStyxFileInputStream
All Implemented Interfaces:
java.io.Closeable

public class CStyxFileInputStream
extends java.io.InputStream

InputStream for reading from a file on a Styx server

Author:
Jon Blower $Revision: 385 $ $Date: 2005-09-01 18:12:11 +0100 (Thu, 01 Sep 2005) $ $Log$ Revision 1.2 2005/09/01 17:12:09 jonblower Changes to Input and Output stream code Revision 1.1 2005/08/31 17:03:18 jonblower Renamed "StyxFile*putStream*" to "CStyxFile*putStream*" for consistency with CStyxFile class Revision 1.8 2005/06/22 17:07:29 jonblower Added read(byte[]) method Revision 1.7 2005/05/12 07:40:52 jonblower CStyxFile.close() no longer throws a StyxException Revision 1.6 2005/05/05 07:09:06 jonblower Improved comments Revision 1.5 2005/05/04 16:25:49 jonblower Improved parameter naming in constructor Revision 1.4 2005/03/22 10:19:52 jonblower Fixed problem with ByteBuffer leak in StyxMessageDecoder and CStyxFileInputStream Revision 1.3 2005/03/19 21:46:58 jonblower Further fixes relating to releasing ByteBuffers Revision 1.2 2005/03/16 17:55:53 jonblower Replaced use of java.nio.ByteBuffer with MINA's ByteBuffer to minimise copying of buffers Revision 1.1.1.1 2005/02/16 18:58:19 jonblower Initial import

Constructor Summary
CStyxFileInputStream(CStyxFile file)
           
CStyxFileInputStream(CStyxFile file, boolean closeConnectionWhenCloseStream)
          Creates a CStyxFileInputStream for reading the given file.
 
Method Summary
 int available()
           
 void close()
          Closes the stream (clunks the underlying file).
 int read()
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CStyxFileInputStream

public CStyxFileInputStream(CStyxFile file,
                            boolean closeConnectionWhenCloseStream)
Creates a CStyxFileInputStream for reading the given file.

Parameters:
file - The file to read from
closeConnectionWhenCloseStream - If this is true, we shall close the underlying StyxConnection when this stream is closed (this is normally set when getting an input stream through the StyxURLConnection class)

CStyxFileInputStream

public CStyxFileInputStream(CStyxFile file)
Method Detail

read

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

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Returns:
the number of bytes that can be read without blocking
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the stream (clunks the underlying file). If this InputStream was created with closeConnectionWhenCloseStream = true, this will also close the StyxConnection.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException


Copyright © 2004-2006 Reading e-Science Centre. All Rights Reserved.