Class InputStreamPumper
- java.lang.Object
-
- io.fabric8.kubernetes.client.utils.InputStreamPumper
-
public class InputStreamPumper extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
InputStreamPumper.Writable
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InputStream
asInterruptible(InputStream is)
Relies onInputStream.available()
and a Thread sleep to ensure that the reads are interruptible.static CompletableFuture<?>
pump(InputStream in, InputStreamPumper.Writable out, Executor executor)
Pumps the givenInputStream
into theInputStreamPumper.Writable
target via a task started in the givenExecutor
.static void
transferTo(InputStream in, InputStreamPumper.Writable out)
See InputStream.transferTo(java.io.OutputStream) in Java 9 or laterstatic OutputStream
writableOutputStream(InputStreamPumper.Writable writer, Integer bufferSize)
-
-
-
Method Detail
-
asInterruptible
public static InputStream asInterruptible(InputStream is)
Relies onInputStream.available()
and a Thread sleep to ensure that the reads are interruptible.
-
transferTo
public static void transferTo(InputStream in, InputStreamPumper.Writable out) throws IOException
See InputStream.transferTo(java.io.OutputStream) in Java 9 or later- Throws:
IOException
-
pump
public static CompletableFuture<?> pump(InputStream in, InputStreamPumper.Writable out, Executor executor)
Pumps the givenInputStream
into theInputStreamPumper.Writable
target via a task started in the givenExecutor
.
The input is not closed by this call.
If theInputStream
is not interruptible, such as System.in, useasInterruptible(InputStream)
to decorate the stream for this call.
-
writableOutputStream
public static OutputStream writableOutputStream(InputStreamPumper.Writable writer, Integer bufferSize)
-
-