Interface RawChannel
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
public interface RawChannel extends java.io.Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
RawChannel.Provider
static interface
RawChannel.RawEvent
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes this channel.java.nio.ByteBuffer
initialByteBuffer()
Hands over the initial bytes.java.nio.ByteBuffer
read()
void
registerEvent(RawChannel.RawEvent event)
void
shutdownInput()
Shutdown the connection for reading without closing the channel.void
shutdownOutput()
Shutdown the connection for writing without closing the channel.long
write(java.nio.ByteBuffer[] srcs, int offset, int length)
-
-
-
Method Detail
-
registerEvent
void registerEvent(RawChannel.RawEvent event) throws java.io.IOException
- Throws:
java.io.IOException
-
initialByteBuffer
java.nio.ByteBuffer initialByteBuffer() throws java.lang.IllegalStateException
Hands over the initial bytes. Once the bytes have been returned they are no longer available and the method will throw anIllegalStateException
on each subsequent invocation.- Returns:
- the initial bytes
- Throws:
java.lang.IllegalStateException
- if the method has been already invoked
-
read
java.nio.ByteBuffer read() throws java.io.IOException
- Throws:
java.io.IOException
-
write
long write(java.nio.ByteBuffer[] srcs, int offset, int length) throws java.io.IOException
- Throws:
java.io.IOException
-
shutdownInput
void shutdownInput() throws java.io.IOException
Shutdown the connection for reading without closing the channel.Once shutdown for reading then further reads on the channel will return
null
, the end-of-stream indication. If the input side of the connection is already shutdown then invoking this method has no effect.- Throws:
java.nio.channels.ClosedChannelException
- If this channel is closedjava.io.IOException
- If some other I/O error occurs
-
shutdownOutput
void shutdownOutput() throws java.io.IOException
Shutdown the connection for writing without closing the channel.Once shutdown for writing then further attempts to write to the channel will throw
ClosedChannelException
. If the output side of the connection is already shutdown then invoking this method has no effect.- Throws:
java.nio.channels.ClosedChannelException
- If this channel is closedjava.io.IOException
- If some other I/O error occurs
-
close
void close() throws java.io.IOException
Closes this channel.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
- If an I/O error occurs
-
-