de.schlichtherle.io
Class CountingReadOnlyFile
java.lang.Object
de.schlichtherle.io.rof.AbstractReadOnlyFile
de.schlichtherle.io.rof.FilterReadOnlyFile
de.schlichtherle.io.CountingReadOnlyFile
- All Implemented Interfaces:
- ReadOnlyFile
final class CountingReadOnlyFile
- extends FilterReadOnlyFile
- Since:
- TrueZIP 6.5
- Version:
- $Id: CountingReadOnlyFile.java 06f3ba684701 2010/11/04 01:15:55 christian $
- Author:
- Christian Schlichtherle
|
Field Summary |
private static boolean |
reset
|
private static long |
total
|
|
Method Summary |
(package private) static long |
getTotal()
Returns the total number of bytes read. |
(package private) static void |
init()
Resets the total number of bytes read if resetOnInit() has been
called before. |
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this read only file into
the given array. |
(package private) static void |
resetOnInit()
Requests that the total number of bytes read gets reset on the
next call to init(). |
int |
skipBytes(int n)
Deprecated. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
total
private static volatile long total
reset
private static volatile boolean reset
CountingReadOnlyFile
CountingReadOnlyFile(ReadOnlyFile rof)
getTotal
static long getTotal()
- Returns the total number of bytes read.
init
static void init()
- Resets the total number of bytes read if
resetOnInit() has been
called before.
resetOnInit
static void resetOnInit()
- Requests that the total number of bytes read gets reset on the
next call to
init().
read
public int read()
throws IOException
- Specified by:
read in interface ReadOnlyFile- Overrides:
read in class FilterReadOnlyFile
- Throws:
IOException
read
public int read(byte[] b)
throws IOException
- Specified by:
read in interface ReadOnlyFile- Overrides:
read in class AbstractReadOnlyFile
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Description copied from interface:
ReadOnlyFile
- Reads up to
len bytes of data from this read only file into
the given array.
This method blocks until at least one byte of input is available.
- Specified by:
read in interface ReadOnlyFile- Overrides:
read in class FilterReadOnlyFile
- Parameters:
b - The buffer to fill with data.off - The start offset of the data.len - The maximum number of bytes to read.
- Returns:
- The total number of bytes read, or
-1 if there is
no more data because the end of the file has been reached.
- Throws:
IOException - On any I/O related issue.
skipBytes
public int skipBytes(int n)
throws IOException
- Deprecated.
- Specified by:
skipBytes in interface ReadOnlyFile- Overrides:
skipBytes in class AbstractReadOnlyFile
- Throws:
IOException
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.