org.gcube.contentmanagement.baselayer.networkFileTransfer.gfal
Class BufferedGFALInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.gcube.contentmanagement.baselayer.networkFileTransfer.gfal.BufferedGFALInputStream
All Implemented Interfaces:
java.io.Closeable

public class BufferedGFALInputStream
extends java.io.InputStream


Field Summary
static int BEHIND_END_OF_FILE
           
 
Constructor Summary
BufferedGFALInputStream(it.infn.catania.gfal.GFalFile inputFile, BasicStorageHints hints)
           
 
Method Summary
 int available()
           
 void close()
           
 long determineStreamLength()
          Tries to determine the length of the stream by jumping to the last position of the stream and back.
 boolean isLargeFile()
          Returns whether this file is a large file (to best knowledge)
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 void setLargeFile(boolean isLargeFile)
          Sets whether the file should use the large file support.
 long skip(long n)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEHIND_END_OF_FILE

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

BufferedGFALInputStream

public BufferedGFALInputStream(it.infn.catania.gfal.GFalFile inputFile,
                               BasicStorageHints hints)
                        throws ValueNotValidException,
                               java.io.IOException
Throws:
ValueNotValidException
java.io.IOException
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)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close 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

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException

available

public int available()
Overrides:
available in class java.io.InputStream

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException

determineStreamLength

public long determineStreamLength()
Tries to determine the length of the stream by jumping to the last position of the stream and back.

Possibly GFalUtilities also does this job, then there is no need to use this non-elagant way.

Returns:
the length in bytes, if it could be determined correctly; BaseLayerStream.STREAM_LENGTH_IMPLICITE otherwise
See Also:
BaseLayerStream.STREAM_LENGTH_IMPLICITE

isLargeFile

public boolean isLargeFile()
Returns whether this file is a large file (to best knowledge)

Returns:
true, if it should use the large file support of the GFalFile
See Also:
GFalFile

setLargeFile

public void setLargeFile(boolean isLargeFile)
Sets whether the file should use the large file support.

Parameters:
isLargeFile - Set true, if you wnat to manage a large file
See Also:
GFalFile