Package org.deltafi.common.io
Class WriterPipedInputStream
java.lang.Object
java.io.InputStream
java.io.PipedInputStream
org.deltafi.common.io.WriterPipedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
FlowFileInputStream
An InputStream providing data written to a supplied Writer running in a separate thread.
-
Field Summary
Fields inherited from class java.io.PipedInputStream
buffer, in, out, PIPE_SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWriterPipedInputStream(Writer writer, ExecutorService executorService) protectedWriterPipedInputStream(Writer writer, ExecutorService executorService, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static WriterPipedInputStreamcreate(Writer writer, ExecutorService executorService) Creates a WriterPipedInputStream with a default buffer size, starting a separate thread for writing.static WriterPipedInputStreamcreate(Writer writer, ExecutorService executorService, int bufferSize) Creates a WriterPipedInputStream, starting a separate thread for writing.protected voidMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
WriterPipedInputStream
- Throws:
IOException
-
WriterPipedInputStream
protected WriterPipedInputStream(Writer writer, ExecutorService executorService, int bufferSize) throws IOException - Throws:
IOException
-
-
Method Details
-
create
public static WriterPipedInputStream create(Writer writer, ExecutorService executorService) throws IOException Creates a WriterPipedInputStream with a default buffer size, starting a separate thread for writing.- Parameters:
writer- the Writer that will write bytes to be available to this WriterPipedInputStreamexecutorService- the ExecutorService used to submit the writing thread- Returns:
- the WriterPipedInputStream
- Throws:
IOException- if an I/O error occurs
-
create
public static WriterPipedInputStream create(Writer writer, ExecutorService executorService, int bufferSize) throws IOException Creates a WriterPipedInputStream, starting a separate thread for writing.- Parameters:
writer- the Writer that will write bytes to be available to this WriterPipedInputStreamexecutorService- the ExecutorService used to submit the writing threadbufferSize- the buffer size- Returns:
- the WriterPipedInputStream
- Throws:
IOException- if an I/O error occurs
-
runPipeWriter
protected void runPipeWriter() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPipedInputStream- Throws:
IOException
-