@Test public void testSize() throws IOException { sizeControllableFile = new SizeControllableFile(file, new FileSize() { @Override public long getSize(LongSupplier realSizeProvider) { return realSizeProvider.getAsLong() - 100; } }); long totalLen = 0; for (int i = 0; i < testCount; i++) { int dataLen = randomInt(1, 1024); sizeControllableFile.getFileChannel().write(ByteBuffer.wrap(randomString(dataLen).getBytes())); totalLen += dataLen; Assert.assertEquals(totalLen - 100, sizeControllableFile.size()); } }
@Override public long size() { return fileSize.getSize(() -> super.size()); }
SizeControllableFile extends AbstractControllableFile { @Override public long size() { return fileSize.getSize(() -> super.size()); } }
SizeControllableFile extends AbstractControllableFile { @Override public long size() { return fileSize.getSize(() -> super.size()); } SizeControllableFile(File file, FileSize fileSize); }
SizeControllableFile extends AbstractControllableFile { @Override public long size() { return fileSize.getSize(() -> super.size()); } SizeControllableFile(File file, FileSize fileSize); @Override long size(); }
SizeControllableFile extends AbstractControllableFile { @Override public long size() { return fileSize.getSize(() -> super.size()); } SizeControllableFile(File file, FileSize fileSize); @Override long size();  }