FileEntityProducer implements AsyncEntityProducer { @Override public long getContentLength() { return length; } FileEntityProducer(final File file, final int bufferSize, final ContentType contentType, final boolean chunked);  FileEntityProducer(final File file, final ContentType contentType, final boolean chunked);  FileEntityProducer(final File file, final ContentType contentType);  FileEntityProducer(final File file); @Override boolean isRepeatable(); @Override String getContentType(); @Override long getContentLength(); @Override int available(); @Override String getContentEncoding(); @Override boolean isChunked(); @Override Set<String> getTrailerNames(); @Override void produce(final DataStreamChannel channel); @Override void failed(final Exception cause); Exception getException(); @Override void releaseResources();  }
@Test public void testFileLengthMaxIntPlusOne() throws IOException { final File file = tempFolder.newFile("test.bin"); try (RandomAccessFile raFile = new RandomAccessFile(file, "rw")) { final long expectedLength = 1L + Integer.MAX_VALUE; raFile.setLength(expectedLength); final FileEntityProducer fileEntityProducer = new FileEntityProducer(file); Assert.assertEquals(expectedLength, fileEntityProducer.getContentLength()); } }