4.68. kink/javahost/JAVA_STREAM_INPUT¶
4.68.1. JAVA_STREAM_INPUT.new(Stream)¶
`new` makes an `input` val which wraps a Java InputStream object specified by `Stream` arg.
Preconditions:
• `Stream` must be a java val.
• The object reference of `Stream` must be an instance of java.io.InputStream.
Example:
:BIN.require_from('kink/')
:CONTROL.require_from('kink/')
:INPUT.require_from('kink/io/')
:JAVA.require_from('kink/javahost/')
:JAVA_STREAM_INPUT.require_from('kink/javahost/')
:Bais_class <- JAVA.class('java.io.ByteArrayInputStream')
:Bais <- Bais_class.new(JAVA.bytes(BIN.of(1 2 3)))
CONTROL.with_finally{(:finally)
:In = JAVA_STREAM_INPUT.new(Bais)
finally{ In.close }
:Bin = INPUT.read_all(In)
stdout.print_line(Bin.repr) # => (bin 0x01 0x02 0x03)
}
See kink/io/INPUT for `input` type.