org.xsocket
Interface IDataSink

Package class diagram package IDataSink
All Known Subinterfaces:
IBlockingConnection, IConnection, INonBlockingConnection
All Known Implementing Classes:
BlockingConnection, NonBlockingConnection, UserDatagram

public interface IDataSink

A data sink is an I/O resource capable of receiving data.


Method Summary
 int write(byte... bytes)
          writes bytes to the data sink
 int write(byte b)
          writes a byte to the data sink
 int write(byte[] bytes, int offset, int length)
          writes bytes to the data sink
 int write(java.nio.ByteBuffer buffer)
          writes a byte buffer to the data sink
 long write(java.nio.ByteBuffer[] buffers)
          writes a byte array to the data sink
 int write(double d)
          writes a double to the data sink
 int write(int i)
          writes a int to the data sink
 int write(long l)
          writes a long to the data sink
 int write(short s)
          writes a short to the data sink
 int write(java.lang.String message)
          writes a message
 int write(java.lang.String message, java.lang.String encoding)
          write a message
 

Method Detail

write

int write(byte b)
          throws java.io.IOException
writes a byte to the data sink

Parameters:
b - the byte to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(byte... bytes)
          throws java.io.IOException
writes bytes to the data sink

Parameters:
bytes - the bytes to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(byte[] bytes,
          int offset,
          int length)
          throws java.io.IOException
writes bytes to the data sink

Parameters:
bytes - the bytes to write
offset - The offset of the subarray to be used; must be non-negative and no larger than array.length. The new buffer`s position will be set to this value.
length - The length of the subarray to be used; must be non-negative and no larger than array.length - offset. The new buffer`s limit will be set to offset + length.
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(java.nio.ByteBuffer buffer)
          throws java.io.IOException
writes a byte buffer to the data sink

Parameters:
buffer - the bytes to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

long write(java.nio.ByteBuffer[] buffers)
           throws java.io.IOException
writes a byte array to the data sink

Parameters:
buffers - the bytes to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(int i)
          throws java.io.IOException
writes a int to the data sink

Parameters:
i - the int value to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(short s)
          throws java.io.IOException
writes a short to the data sink

Parameters:
s - the short value to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(long l)
          throws java.io.IOException
writes a long to the data sink

Parameters:
l - the int value to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(double d)
          throws java.io.IOException
writes a double to the data sink

Parameters:
d - the int value to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(java.lang.String message,
          java.lang.String encoding)
          throws java.io.IOException
write a message

Parameters:
message - the message to write
encoding - the encoding which should be used th encode the chars into byte (e.g. `US-ASCII` or `UTF-8`)
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs

write

int write(java.lang.String message)
          throws java.io.IOException
writes a message

Parameters:
message - the message to write
Returns:
the number of send bytes
Throws:
java.io.IOException - If some other I/O error occurs