com.fasterxml.clustermate.client.ahc.BodyFileBacked Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clustermate-client-ahc Show documentation
Show all versions of clustermate-client-ahc Show documentation
Almost complete ClusterMate NetworkClient implementation built on
Async HTTP Client
The newest version!
package com.fasterxml.clustermate.client.ahc;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Implementation that reads content from specified {@link java.io.File}.
*
* Chunked transfer encoding is used for files that are big enough;
* currently cut-off point is 64k.
*/
public class BodyFileBacked extends BodyStreamBacked
{
protected final long _length;
public BodyFileBacked(File f, long contentLength,
AtomicInteger checksum) throws IOException
{
super(new FileInputStream(f), checksum);
_length = contentLength;
}
@Override
public long getContentLength() {
return _length;
}
}