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
@@ -61,6 +61,12 @@ class CryptoReadableFile implements ReadableFile {
}
}
@Override
public long size() throws UncheckedIOException {
assert decryptor != null : "decryptor is always being set during position(long)";
return decryptor.contentLength();
}
@Override
public void position(long position) throws UncheckedIOException {
if (readAheadTask != null) {
@@ -109,6 +109,7 @@ class CryptoWritableFile implements WritableFile {
encryptor.append(FileContentCryptor.EOF);
writeTask.get();
writeHeader();
// TODO append padding
} catch (ExecutionException e) {
if (e.getCause() instanceof UncheckedIOException) {
throw (UncheckedIOException) e.getCause();