Package org.jruby.util.io
Class ChannelHelper
java.lang.Object
org.jruby.util.io.ChannelHelper
Helper that attempts to improve Channels' static helpers.
- Author:
- kares
-
Method Summary
Modifier and TypeMethodDescriptionstatic ReadableByteChannel
readableChannel
(InputStream inputStream) static InputStream
unwrapBufferedStream
(InputStream filteredStream) Unwrap all filtering streams between the given stream and its actual unfiltered stream.static OutputStream
unwrapBufferedStream
(OutputStream filteredStream) Unwrap all filtering streams between the given stream and its actual unfiltered stream.static InputStream
unwrapFilterInputStream
(InputStream filteredStream) Unwrap the given stream to its first non-FilterInputStream.static OutputStream
unwrapFilterOutputStream
(OutputStream filteredStream) Unwrap the given stream to its first non-FilterOutputStream.static WritableByteChannel
writableChannel
(OutputStream outputStream)
-
Method Details
-
readableChannel
-
writableChannel
-
unwrapBufferedStream
Unwrap all filtering streams between the given stream and its actual unfiltered stream. This is primarily to unwrap streams that have buffers that would interfere with interactivity.- Parameters:
filteredStream
- The stream to unwrap- Returns:
- An unwrapped stream, presumably unbuffered
-
unwrapBufferedStream
Unwrap all filtering streams between the given stream and its actual unfiltered stream. This is primarily to unwrap streams that have buffers that would interfere with interactivity.- Parameters:
filteredStream
- The stream to unwrap- Returns:
- An unwrapped stream, presumably unbuffered
-
unwrapFilterOutputStream
Unwrap the given stream to its first non-FilterOutputStream. If the stream is not a FilterOutputStream it is returned immediately. Note that this version is used when you are absolutely sure you want to unwrap; the unwrapBufferedStream version will perform checks for certain types of process-related streams that should not be unwrapped (Java 7+ Process, e.g.).- Parameters:
filteredStream
- a stream to be unwrapped, if it is a FilterOutputStream- Returns:
- the deeped non-FilterOutputStream stream, or filterOutputStream if it is not a FilterOutputStream to begin with.
-
unwrapFilterInputStream
Unwrap the given stream to its first non-FilterInputStream. If the stream is not a FilterInputStream it is returned immediately. Note that this version is used when you are absolutely sure you want to unwrap; the unwrapBufferedStream version will perform checks for certain types of process-related streams that should not be unwrapped (Java 7+ Process, e.g.).- Parameters:
filteredStream
- a stream to be unwrapped, if it is a FilterInputStream- Returns:
- the deeped non-FilterInputStream stream, or filterInputStream if it is not a FilterInputStream to begin with.
-