Package org.java_websocket
Class AbstractWrappedByteChannel
- java.lang.Object
-
- org.java_websocket.AbstractWrappedByteChannel
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,ReadableByteChannel
,WritableByteChannel
,WrappedByteChannel
- Direct Known Subclasses:
AbstractClientProxyChannel
public class AbstractWrappedByteChannel extends Object implements WrappedByteChannel
-
-
Constructor Summary
Constructors Constructor Description AbstractWrappedByteChannel(ByteChannel towrap)
AbstractWrappedByteChannel(WrappedByteChannel towrap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
isBlocking()
This function returns the blocking state of the channelboolean
isNeedRead()
returns whether readMore should be called to fetch data which has been decoded but not yet been returned.boolean
isNeedWrite()
returns whether writeMore should be called write additional data.boolean
isOpen()
int
read(ByteBuffer dst)
int
readMore(ByteBuffer dst)
This function does not read data from the underlying channel at all.int
write(ByteBuffer src)
void
writeMore()
Gets called whenWrappedByteChannel.isNeedWrite()
()} requires a additional rite
-
-
-
Constructor Detail
-
AbstractWrappedByteChannel
public AbstractWrappedByteChannel(ByteChannel towrap)
-
AbstractWrappedByteChannel
public AbstractWrappedByteChannel(WrappedByteChannel towrap)
-
-
Method Detail
-
read
public int read(ByteBuffer dst) throws IOException
- Specified by:
read
in interfaceReadableByteChannel
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
write
public int write(ByteBuffer src) throws IOException
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
isNeedWrite
public boolean isNeedWrite()
Description copied from interface:WrappedByteChannel
returns whether writeMore should be called write additional data.- Specified by:
isNeedWrite
in interfaceWrappedByteChannel
- Returns:
- is a additional write needed
-
writeMore
public void writeMore() throws IOException
Description copied from interface:WrappedByteChannel
Gets called whenWrappedByteChannel.isNeedWrite()
()} requires a additional rite- Specified by:
writeMore
in interfaceWrappedByteChannel
- Throws:
IOException
- may be thrown due to an error while writing
-
isNeedRead
public boolean isNeedRead()
Description copied from interface:WrappedByteChannel
returns whether readMore should be called to fetch data which has been decoded but not yet been returned.- Specified by:
isNeedRead
in interfaceWrappedByteChannel
- Returns:
- is a additional read needed
- See Also:
ReadableByteChannel.read(ByteBuffer)
,WrappedByteChannel.readMore(ByteBuffer)
-
readMore
public int readMore(ByteBuffer dst) throws IOException
Description copied from interface:WrappedByteChannel
This function does not read data from the underlying channel at all. It is just a way to fetch data which has already be received or decoded but was but was not yet returned to the user. This could be the case when the decoded data did not fit into the buffer the user passed toReadableByteChannel.read(ByteBuffer)
.- Specified by:
readMore
in interfaceWrappedByteChannel
- Parameters:
dst
- the destiny of the read- Returns:
- the amount of remaining data
- Throws:
IOException
- when a error occurred during unwrapping
-
isBlocking
public boolean isBlocking()
Description copied from interface:WrappedByteChannel
This function returns the blocking state of the channel- Specified by:
isBlocking
in interfaceWrappedByteChannel
- Returns:
- is the channel blocking
-
-