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
-
debug
- Enables or disables the Debug mode of operation
-
numofCloses
- Keeps a count of closed filestreams
-
testing
-
-
FileInputStream(File)
- Constructor
-
FileInputStream(String)
- Main class constructor.
-
available()
- Returns the number of bytes that can be read from this input stream without
blocking.
-
clearCache()
- Clears the cache data and updates the Caching parameters
-
clearIOStats()
- Clears the IO statistics variables.
-
close()
- Closes this input stream and releases any system resources associated with the
stream.
-
closeAll()
- Closes all the opened streams
-
finalize()
-
Finalization method.
-
getCachedDataSize()
- Returns the size of the cached data
-
getCachingtime()
- Returns the Caching time
-
getContentLength()
- Returns the stream length
-
getIOtime()
- Returns the IO time spent in executing the current benchmark
-
getNumCacheByteReads()
- Returns the number of bytes read from the cache
-
getNumCachedFiles()
-
Returns the number of Cached files
-
getNumCacheHits()
- Returns the number of cache hits in executing the current benchmark
-
getNumCacheMisses()
-
Returns the number of cache misses in executing the current benchmark
-
getNumFileByteReads()
- Returns the number of bytes read from the file
-
getNumOpenFiles()
- Returns the number of open files
-
getNumUrlByteReads()
- Returns the number of bytes read form the URL
-
getNumUsedFiles()
-
Returns the number of used files
-
getTotalRetries()
- Return the total retries
-
IsURLOk(URL)
- Checks whether the given URL is valid or not.
-
read()
- Reads the next byte of data from this input stream.
-
read(byte[])
- Reads up to byte.length bytes of data from this input stream into an array of
bytes.
-
read(byte[], int, int)
- Reads up to len bytes of data from this input stream into an array of bytes.
-
skip(long)
- Skips over and discards n bytes of data from the input stream.
debug
public static boolean debug
- Enables or disables the Debug mode of operation
testing
public static boolean testing
numofCloses
public static int numofCloses
- Keeps a count of closed filestreams
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.
FileInputStream
public FileInputStream(File file) throws FileNotFoundException, MalformedURLException, IOException
- Constructor
- Parameters:
- file - File object
clearCache
public static void clearCache()
- Clears the cache data and updates the Caching parameters
closeAll
public static void closeAll() throws IOException
- Closes all the opened streams
getNumOpenFiles
public static int getNumOpenFiles()
- Returns the number of open files
getNumUsedFiles
public static int getNumUsedFiles()
- Returns the number of used files
getNumCachedFiles
public static int getNumCachedFiles()
- Returns the number of Cached files
getCachedDataSize
public static int getCachedDataSize()
- Returns the size of the cached data
getNumCacheByteReads
public static int getNumCacheByteReads()
- Returns the number of bytes read from the cache
getNumFileByteReads
public static int getNumFileByteReads()
- Returns the number of bytes read from the file
getNumUrlByteReads
public static int getNumUrlByteReads()
- Returns the number of bytes read form the URL
getNumCacheHits
public static int getNumCacheHits()
- Returns the number of cache hits in executing the current benchmark
getNumCacheMisses
public static int getNumCacheMisses()
- Returns the number of cache misses in executing the current benchmark
getIOtime
public static long getIOtime()
- Returns the IO time spent in executing the current benchmark
getCachingtime
public static long getCachingtime()
- Returns the Caching time
getTotalRetries
public static int getTotalRetries()
- Return the total retries
clearIOStats
public static void clearIOStats()
- Clears the IO statistics variables.
IsURLOk
public static boolean IsURLOk(URL url)
- Checks whether the given URL is valid or not.
getContentLength
public int getContentLength()
- Returns the stream length
available
public synchronized int available() throws IOException
- Returns the number of bytes that can be read from this input stream without
blocking.
read
public synchronized int read() throws IOException
- Reads the next byte of data from this input stream.
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
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
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.
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
finalize
protected void finalize() throws IOException
- Finalization method.
All Packages Class Hierarchy This Package Previous Next Index