Added ReadableFile#size()

This commit is contained in:
Sebastian Stenzel
2016-01-09 16:39:14 +01:00
parent 0c42392244
commit fcf4476ae3
10 changed files with 53 additions and 6 deletions
@@ -29,8 +29,16 @@ public interface ReadableFile extends ReadableByteChannel {
* if an {@link IOException} occurs while reading from this
* {@code ReadableBytes}
*/
@Override
int read(ByteBuffer target) throws UncheckedIOException;
/**
* @return The current size of the file. This value is a snapshot and might have been changed by concurrent modifications.
* @throws UncheckedIOException
* if an {@link IOException} occurs
*/
long size() throws UncheckedIOException;
/**
* <p>
* Fast-forwards or rewinds the file to the specified position.
@@ -42,6 +42,11 @@ public class DelegatingReadableFile implements ReadableFile {
return delegate.read(target);
}
@Override
public long size() throws UncheckedIOException {
return delegate.size();
}
@Override
public void position(long position) throws UncheckedIOException {
delegate.position(position);