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 known
Content-Length.
Memory footprint is a single reusable byte[] buffer; data is never duplicated once inside
user-space.-
Constructor Summary
ConstructorsConstructorDescriptionInputStreamFixedLenProducer(InputStream source, long contentLength) InputStreamFixedLenProducer(InputStream source, long contentLength, int bufferSize) -
Method Summary
-
Constructor Details
-
InputStreamFixedLenProducer
- 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
-
-
Method Details
-
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
- Specified by:
getContentTypein interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentEncoding
- Specified by:
getContentEncodingin interfaceorg.apache.hc.core5.http.EntityDetails
-
getTrailerNames
-
available
public int available()- Specified by:
availablein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
-
produce
Called 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
- 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
-