Package com.ocient.cli.extract

# Class AsyncS3OutputStream

java.lang.Object
java.io.OutputStream
com.ocient.cli.extract.AsyncS3OutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

public class AsyncS3OutputStream extends OutputStream

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final int`
`DEFAULT_BUFFER_SIZE`

## Constructor Summary

Constructors
Constructor
Description
`AsyncS3OutputStream(software.amazon.awssdk.services.s3.S3AsyncClient s3Client, String bucket, String filePath, int uploadPartSize, com.ibm.asyncutil.locks.AsyncSemaphore uploadPartSemaphore, Optional<ExtractMetrics> metrics)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`flush()`
`CompletionStage<Void>`
`onStreamClosed()`
Returns a future that completes when the underlying `OutputStream` has been closed.
`void`
`write(byte[] byteArray)`
`void`
`write(byte[] byteArray, int offset, int length)`
`void`
`write(int b)`

### Methods inherited from class java.io.OutputStream

`nullOutputStream`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_BUFFER_SIZE

protected static final int DEFAULT_BUFFER_SIZE

See Also:
  - Constant Field Values

## Constructor Details

### AsyncS3OutputStream

public AsyncS3OutputStream(software.amazon.awssdk.services.s3.S3AsyncClient s3Client, String bucket, String filePath, int uploadPartSize, com.ibm.asyncutil.locks.AsyncSemaphore uploadPartSemaphore, Optional<ExtractMetrics> metrics) throws IOException

Parameters:
  `s3Client` - The AmazonS3 client. Created by the caller
  `bucket` - S3 bucket
  `filePath` - path within the bucket
Throws:
  `IOException`

## Method Details

### onStreamClosed

public CompletionStage<Void> onStreamClosed()
Returns a future that completes when the underlying `OutputStream` has been closed. Importantly, calling this method does not trigger the close process. Callers are expected to call `close()`.

### write

public void write(byte[] byteArray) throws IOException

Overrides:
  `write` in class `OutputStream`
Throws:
  `IOException`

### write

public void write(byte[] byteArray, int offset, int length) throws IOException

Overrides:
  `write` in class `OutputStream`
Throws:
  `IOException`

### write

public void write(int b) throws IOException

Specified by:
  `write` in class `OutputStream`
Throws:
  `IOException`

### flush

public void flush()

Specified by:
  `flush` in interface `Flushable`
Overrides:
  `flush` in class `OutputStream`

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `OutputStream`
Throws:
  `IOException`