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 interfaceInputStreamPumper.Writable
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InputStreamasInterruptible(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 givenInputStreaminto theInputStreamPumper.Writabletarget via a task started in the givenExecutor.static voidtransferTo(InputStream in, InputStreamPumper.Writable out)See InputStream.transferTo(java.io.OutputStream) in Java 9 or laterstatic OutputStreamwritableOutputStream(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 givenInputStreaminto theInputStreamPumper.Writabletarget via a task started in the givenExecutor.
The input is not closed by this call.
If theInputStreamis 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)
-
-