public class InputStreamChannel extends Object implements ReadableByteChannel, BlockableChannel
Constructor and Description |
---|
InputStreamChannel(InputStream inputStream)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying input stream.
|
protected InputStream |
getInputStream()
Returns the underlying input stream.
|
boolean |
isBlocking()
True if the underlying input stream is able to indicate available bytes
upfront.
|
boolean |
isOpen()
Indicates if the channel and its underlying stream are open.
|
int |
read(ByteBuffer target)
Reads bytes from the underlying stream to the target buffer.
|
public InputStreamChannel(InputStream inputStream) throws IOException
inputStream
- IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
IOException
protected InputStream getInputStream()
public boolean isBlocking()
isBlocking
in interface BlockableChannel
public boolean isOpen()
public int read(ByteBuffer target) throws IOException
read
in interface ReadableByteChannel
target
- The target byte buffer.IOException
Copyright © 2005–2017. All rights reserved.