All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class spec.io.FileInputStream

spec.io.FileInputStream

public class FileInputStream
This class extends the java.io.InputStream and provides some extra functionality for caching the data. It also keeps a count of the number of filestreams opened by the SpecJVMClient, number of files read, number of bytes read, io times spent

See Also:
InputStream, FileCacheData

Variable Index

 o debug
Enables or disables the Debug mode of operation
 o numofCloses
Keeps a count of closed filestreams
 o testing

Constructor Index

 o FileInputStream(File)
Constructor
 o FileInputStream(String)
Main class constructor.

Method Index

 o available()
Returns the number of bytes that can be read from this input stream without blocking.
 o clearCache()
Clears the cache data and updates the Caching parameters
 o clearIOStats()
Clears the IO statistics variables.
 o close()
Closes this input stream and releases any system resources associated with the stream.
 o closeAll()
Closes all the opened streams
 o finalize()
Finalization method.
 o getCachedDataSize()
Returns the size of the cached data
 o getCachingtime()
Returns the Caching time
 o getContentLength()
Returns the stream length
 o getIOtime()
Returns the IO time spent in executing the current benchmark
 o getNumCacheByteReads()
Returns the number of bytes read from the cache
 o getNumCachedFiles()
Returns the number of Cached files
 o getNumCacheHits()
Returns the number of cache hits in executing the current benchmark
 o getNumCacheMisses()
Returns the number of cache misses in executing the current benchmark
 o getNumFileByteReads()
Returns the number of bytes read from the file
 o getNumOpenFiles()
Returns the number of open files
 o getNumUrlByteReads()
Returns the number of bytes read form the URL
 o getNumUsedFiles()
Returns the number of used files
 o getTotalRetries()
Return the total retries
 o IsURLOk(URL)
Checks whether the given URL is valid or not.
 o read()
Reads the next byte of data from this input stream.
 o read(byte[])
Reads up to byte.length bytes of data from this input stream into an array of bytes.
 o read(byte[], int, int)
Reads up to len bytes of data from this input stream into an array of bytes.
 o skip(long)
Skips over and discards n bytes of data from the input stream.

Variables

 o debug
 public static boolean debug
Enables or disables the Debug mode of operation

 o testing
 public static boolean testing
 o numofCloses
 public static int numofCloses
Keeps a count of closed filestreams

Constructors

 o FileInputStream
 public FileInputStream(String input_filename) throws FileNotFoundException, MalformedURLException, IOException
Main class constructor. Try and find the strange URL open bug by catching any exceptions and calling the System finalizer to try and close the sockets.

 o FileInputStream
 public FileInputStream(File file) throws FileNotFoundException, MalformedURLException, IOException
Constructor

Parameters:
file - File object

Methods

 o clearCache
 public static void clearCache()
Clears the cache data and updates the Caching parameters

 o closeAll
 public static void closeAll() throws IOException
Closes all the opened streams

 o getNumOpenFiles
 public static int getNumOpenFiles()
Returns the number of open files

 o getNumUsedFiles
 public static int getNumUsedFiles()
Returns the number of used files

 o getNumCachedFiles
 public static int getNumCachedFiles()
Returns the number of Cached files

 o getCachedDataSize
 public static int getCachedDataSize()
Returns the size of the cached data

 o getNumCacheByteReads
 public static int getNumCacheByteReads()
Returns the number of bytes read from the cache

 o getNumFileByteReads
 public static int getNumFileByteReads()
Returns the number of bytes read from the file

 o getNumUrlByteReads
 public static int getNumUrlByteReads()
Returns the number of bytes read form the URL

 o getNumCacheHits
 public static int getNumCacheHits()
Returns the number of cache hits in executing the current benchmark

 o getNumCacheMisses
 public static int getNumCacheMisses()
Returns the number of cache misses in executing the current benchmark

 o getIOtime
 public static long getIOtime()
Returns the IO time spent in executing the current benchmark

 o getCachingtime
 public static long getCachingtime()
Returns the Caching time

 o getTotalRetries
 public static int getTotalRetries()
Return the total retries

 o clearIOStats
 public static void clearIOStats()
Clears the IO statistics variables.

 o IsURLOk
 public static boolean IsURLOk(URL url)
Checks whether the given URL is valid or not.

 o getContentLength
 public int getContentLength()
Returns the stream length

 o available
 public synchronized int available() throws IOException
Returns the number of bytes that can be read from this input stream without blocking.

 o read
 public synchronized int read() throws IOException
Reads the next byte of data from this input stream.

 o read
 public int read(byte b[]) throws IOException
Reads up to byte.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available. The read method of FilterInputStream calls the read method of three arguments with the arguments b, 0, and b.length, and returns whatever value that method returns. Note that this method does not call the one-argument read method of its underlying stream with the single argument b. Subclasses of FilterInputStream do not need to override this method if they have overridden the three-argument read method.

Parameters:
b - Buffer into which the data is read
 o read
 public synchronized int read(byte b[],
                              int off,
                              int len) throws IOException
Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available. The read method of FilterInputStream calls the read method of its underlying input stream with the same arguments and returns whatever value that method returns.

Parameters:
b - - the buffer into which the data is read
off - - the start offset of the data
len - - the maximum number of bytes read
 o close
 public void close() throws IOException
Closes this input stream and releases any system resources associated with the stream. The close method of FilterInputStream calls the close method of its underlying input stream.

 o skip
 public long skip(long n) throws IOException
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned. The skip method of FilterInputStream calls the skip method of its underlying input stream with the same argument, and returns whatever value that method does.

Parameters:
n - - number of bytes to be skipped
 o finalize
 protected void finalize() throws IOException
Finalization method.


All Packages  Class Hierarchy  This Package  Previous  Next  Index