Class InputStreamFixedLenProducer
- java.lang.Object
-
- com.databricks.jdbc.api.impl.volume.InputStreamFixedLenProducer
-
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hc.core5.http.EntityDetails,org.apache.hc.core5.http.nio.AsyncDataProducer,org.apache.hc.core5.http.nio.AsyncEntityProducer,org.apache.hc.core5.http.nio.ResourceHolder
public final class InputStreamFixedLenProducer extends Object implements org.apache.hc.core5.http.nio.AsyncEntityProducer, Closeable
Minimal-copy streaming producer for a single-shot PUT/POST with a knownContent-Length. Memory footprint is a single reusable byte[] buffer; data is never duplicated once inside user-space.
-
-
Constructor Summary
Constructors Constructor Description InputStreamFixedLenProducer(InputStream source, long contentLength)InputStreamFixedLenProducer(InputStream source, long contentLength, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()voidfailed(Exception cause)StringgetContentEncoding()longgetContentLength()StringgetContentType()Set<String>getTrailerNames()booleanisChunked()booleanisRepeatable()voidproduce(org.apache.hc.core5.http.nio.DataStreamChannel channel)Called by the reactor whenever the socket can accept more bytes.voidreleaseResources()
-
-
-
Constructor Detail
-
InputStreamFixedLenProducer
public InputStreamFixedLenProducer(InputStream source, long contentLength, int bufferSize)
- Parameters:
source- Input stream to upload. Caller still owns the stream until this producer is closed or an error occurs.contentLength- Total number of bytes that will be read fromsource.bufferSize- Size of the reusable transfer buffer.
-
InputStreamFixedLenProducer
public InputStreamFixedLenProducer(InputStream source, long contentLength)
-
-
Method Detail
-
isRepeatable
public boolean isRepeatable()
- Specified by:
isRepeatablein interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
isChunked
public boolean isChunked()
- Specified by:
isChunkedin interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentLength
public long getContentLength()
- Specified by:
getContentLengthin interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentEncoding
public String getContentEncoding()
- Specified by:
getContentEncodingin interfaceorg.apache.hc.core5.http.EntityDetails
-
getTrailerNames
public Set<String> getTrailerNames()
- Specified by:
getTrailerNamesin interfaceorg.apache.hc.core5.http.EntityDetails
-
available
public int available()
- Specified by:
availablein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
-
produce
public void produce(org.apache.hc.core5.http.nio.DataStreamChannel channel) throws IOExceptionCalled by the reactor whenever the socket can accept more bytes. Handles partial writes by retaining an outboundByteBuffer.- Specified by:
producein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer- Throws:
IOException
-
failed
public void failed(Exception cause)
- Specified by:
failedin interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
releaseResources
public void releaseResources()
- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-