Top Fields Constructors Methods
org.java_websocket

public Class AbstractWrappedByteChannel

extends Object
implements WrappedByteChannel
Class Inheritance
All Implemented Interfaces
org.java_websocket.WrappedByteChannel, java.nio.channels.ByteChannel, java.nio.channels.WritableByteChannel, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ReadableByteChannel
Annotations
@Deprecated
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.ByteChannel, .SocketChannel

Deprecated

Field Summary

Modifier and TypeField and Description
private final ByteChannel

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.nio.channels.Channel.close.

Closes this channel.

public boolean
isBlocking()

Implements org.java_websocket.WrappedByteChannel.isBlocking.

This function returns the blocking state of the channel

public boolean
isNeedRead()

Implements org.java_websocket.WrappedByteChannel.isNeedRead.

returns whether readMore should be called to fetch data which has been decoded but not yet been returned.

public boolean
isNeedWrite()

Implements org.java_websocket.WrappedByteChannel.isNeedWrite.

returns whether writeMore should be called write additional data.

public boolean
isOpen()

Implements java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

public int
read(ByteBuffer dst)

Implements java.nio.channels.ReadableByteChannel.read.

Reads a sequence of bytes from this channel into the given buffer.

public int
readMore(ByteBuffer dst)

Implements org.java_websocket.WrappedByteChannel.readMore.

This function does not read data from the underlying channel at all.

public int
write(ByteBuffer src)

Implements java.nio.channels.WritableByteChannel.write.

Writes a sequence of bytes to this channel from the given buffer.

public void
writeMore()

Implements org.java_websocket.WrappedByteChannel.writeMore.

Gets called when isNeedWrite() ()} requires a additional rite

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

channelback to summary
private final ByteChannel channel

Constructor Detail

AbstractWrappedByteChannelback to summary
public AbstractWrappedByteChannel(ByteChannel towrap)

Deprecated

Annotations
@Deprecated
AbstractWrappedByteChannelback to summary
public AbstractWrappedByteChannel(WrappedByteChannel towrap)

Deprecated

Annotations
@Deprecated

Method Detail

closeback to summary
public void close() throws IOException

Implements java.nio.channels.Channel.close.

Doc from java.nio.channels.Channel.close.

Closes this channel.

After a channel is closed, any further attempt to invoke I/O operations upon it will cause a ClosedChannelException to be thrown.

If this channel is already closed then invoking this method has no effect.

This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
isBlockingback to summary
public boolean isBlocking()

Implements org.java_websocket.WrappedByteChannel.isBlocking.

Doc from org.java_websocket.WrappedByteChannel.isBlocking.

This function returns the blocking state of the channel

Annotations
@Override
isNeedReadback to summary
public boolean isNeedRead()

Implements org.java_websocket.WrappedByteChannel.isNeedRead.

Doc from org.java_websocket.WrappedByteChannel.isNeedRead.

returns whether readMore should be called to fetch data which has been decoded but not yet been returned.

Annotations
@Override
isNeedWriteback to summary
public boolean isNeedWrite()

Implements org.java_websocket.WrappedByteChannel.isNeedWrite.

Doc from org.java_websocket.WrappedByteChannel.isNeedWrite.

returns whether writeMore should be called write additional data.

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements java.nio.channels.Channel.isOpen.

Doc from java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

Annotations
@Override
readback to summary
public int read(ByteBuffer dst) throws IOException

Implements java.nio.channels.ReadableByteChannel.read.

Doc from java.nio.channels.ReadableByteChannel.read.

Reads a sequence of bytes from this channel into the given buffer.

An attempt is made to read up to r bytes from the channel, where r is the number of bytes remaining in the buffer, that is, dst.remaining(), at the moment this method is invoked.

Suppose that a byte sequence of length n is read, where 0 <= n <= r. This byte sequence will be transferred into the buffer so that the first byte in the sequence is at index p and the last byte is at index p + n - 1, where p is the buffer's position at the moment this method is invoked. Upon return the buffer's position will be equal to p + n; its limit will not have changed.

A read operation might not fill the buffer, and in fact it might not read any bytes at all. Whether or not it does so depends upon the nature and state of the channel. A socket channel in non-blocking mode, for example, cannot read any more bytes than are immediately available from the socket's input buffer; similarly, a file channel cannot read any more bytes than remain in the file. It is guaranteed, however, that if a channel is in blocking mode and there is at least one byte remaining in the buffer then this method will block until at least one byte is read.

This method may be invoked at any time. If another thread has already initiated a read operation upon this channel, however, then an invocation of this method will block until the first operation is complete.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
readMoreback to summary
public int readMore(ByteBuffer dst) throws IOException

Implements org.java_websocket.WrappedByteChannel.readMore.

Doc from org.java_websocket.WrappedByteChannel.readMore.

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 to read(ByteBuffer).

Annotations
@Override
Exceptions
IOException:
when a error occurred during unwrapping
writeback to summary
public int write(ByteBuffer src) throws IOException

Implements java.nio.channels.WritableByteChannel.write.

Doc from java.nio.channels.WritableByteChannel.write.

Writes a sequence of bytes to this channel from the given buffer.

An attempt is made to write up to r bytes to the channel, where r is the number of bytes remaining in the buffer, that is, src.remaining(), at the moment this method is invoked.

Suppose that a byte sequence of length n is written, where 0 <= n <= r. This byte sequence will be transferred from the buffer starting at index p, where p is the buffer's position at the moment this method is invoked; the index of the last byte written will be p + n - 1. Upon return the buffer's position will be equal to p + n; its limit will not have changed.

Unless otherwise specified, a write operation will return only after writing all of the r requested bytes. Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer.

This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
writeMoreback to summary
public void writeMore() throws IOException

Implements org.java_websocket.WrappedByteChannel.writeMore.

Doc from org.java_websocket.WrappedByteChannel.writeMore.

Gets called when isNeedWrite() ()} requires a additional rite

Annotations
@Override
Exceptions
IOException:
may be thrown due to an error while writing