TrueZIP 6.8.3

de.schlichtherle.io
Class CountingReadOnlyFile

java.lang.Object
  extended by de.schlichtherle.io.rof.AbstractReadOnlyFile
      extended by de.schlichtherle.io.rof.FilterReadOnlyFile
          extended by de.schlichtherle.io.CountingReadOnlyFile
All Implemented Interfaces:
ReadOnlyFile

final class CountingReadOnlyFile
extends FilterReadOnlyFile

Since:
TrueZIP 6.5
Author:
Christian Schlichtherle

Field Summary
private static boolean reset
           
private static long total
           
 
Fields inherited from class de.schlichtherle.io.rof.FilterReadOnlyFile
rof
 
Constructor Summary
CountingReadOnlyFile(ReadOnlyFile rof)
           
 
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 de.schlichtherle.io.rof.FilterReadOnlyFile
close, getFilePointer, length, seek
 
Methods inherited from class de.schlichtherle.io.rof.AbstractReadOnlyFile
readFully, readFully
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

total

private static volatile long total

reset

private static volatile boolean reset
Constructor Detail

CountingReadOnlyFile

CountingReadOnlyFile(ReadOnlyFile rof)
Method Detail

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

TrueZIP 6.8.3

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.