org.xsocket
Interface IDataSource

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

public interface IDataSource

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


Method Summary
 byte readByte()
          read a byte
 byte[] readBytesByDelimiter(java.lang.String delimiter, int maxLength)
          read a byte array by using a delimiter For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes
 byte[] readBytesByLength(int length)
          read bytes by using a length defintion
 double readDouble()
          read a double
 int readInt()
          read an int
 long readLong()
          read a long
 short readShort()
          read a short value
 java.lang.String readStringByDelimiter(java.lang.String delimiter)
          read a string by using a delimiter and the connection default encoding
 java.lang.String readStringByDelimiter(java.lang.String delimiter, int maxLength)
          read a string by using a delimiter and the connection default encoding
 java.lang.String readStringByDelimiter(java.lang.String delimiter, java.lang.String encoding, int maxLength)
          read a string by using a delimiter
 java.lang.String readStringByLength(int length)
          read a string by using a length definition and the connection default encoding
 java.lang.String readStringByLength(int length, java.lang.String encoding)
          read a string by using a length definition
 

Method Detail

readByte

byte readByte()
              throws java.io.IOException
read a byte

Returns:
the byte value
Throws:
java.io.IOException - If some other I/O error occurs

readShort

short readShort()
                throws java.io.IOException
read a short value

Returns:
the short value
Throws:
java.io.IOException - If some other I/O error occurs

readInt

int readInt()
            throws java.io.IOException
read an int

Returns:
the int value
Throws:
java.io.IOException - If some other I/O error occurs

readLong

long readLong()
              throws java.io.IOException
read a long

Returns:
the long value
Throws:
java.io.IOException - If some other I/O error occurs

readDouble

double readDouble()
                  throws java.io.IOException
read a double

Returns:
the double value
Throws:
java.io.IOException - If some other I/O error occurs

readBytesByLength

byte[] readBytesByLength(int length)
                         throws java.io.IOException
read bytes by using a length defintion

Parameters:
length - the amount of bytes to read
Returns:
the read bytes
Throws:
java.io.IOException - If some other I/O error occurs

readStringByLength

java.lang.String readStringByLength(int length)
                                    throws java.io.IOException,
                                           java.io.UnsupportedEncodingException
read a string by using a length definition and the connection default encoding

Parameters:
length - the amount of bytes to read
Returns:
the string
Throws:
java.io.IOException - If some other I/O error occurs
java.io.UnsupportedEncodingException - if the given encoding is not supported

readStringByLength

java.lang.String readStringByLength(int length,
                                    java.lang.String encoding)
                                    throws java.io.IOException,
                                           java.io.UnsupportedEncodingException
read a string by using a length definition

Parameters:
length - the amount of bytes to read
encoding - the encodin to use
Returns:
the string
Throws:
java.io.IOException - If some other I/O error occurs
java.io.UnsupportedEncodingException - if the given encoding is not supported

readStringByDelimiter

java.lang.String readStringByDelimiter(java.lang.String delimiter)
                                       throws java.io.IOException,
                                              java.io.UnsupportedEncodingException
read a string by using a delimiter and the connection default encoding

Parameters:
delimiter - the delimiter
Returns:
the string
Throws:
java.io.IOException - If some other I/O error occurs
java.io.UnsupportedEncodingException - if the default encoding is not supported

readStringByDelimiter

java.lang.String readStringByDelimiter(java.lang.String delimiter,
                                       int maxLength)
                                       throws java.io.IOException,
                                              java.io.UnsupportedEncodingException,
                                              MaxReadSizeExceededException
read a string by using a delimiter and the connection default encoding

Parameters:
delimiter - the delimiter
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
the string
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
java.io.IOException - If some other I/O error occurs
java.io.UnsupportedEncodingException - if the default encoding is not supported

readStringByDelimiter

java.lang.String readStringByDelimiter(java.lang.String delimiter,
                                       java.lang.String encoding,
                                       int maxLength)
                                       throws java.io.IOException,
                                              java.io.UnsupportedEncodingException,
                                              MaxReadSizeExceededException
read a string by using a delimiter

Parameters:
delimiter - the delimiter
encoding - the encodin to use
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
the string
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
java.io.IOException - If some other I/O error occurs
java.io.UnsupportedEncodingException - if the given encoding is not supported

readBytesByDelimiter

byte[] readBytesByDelimiter(java.lang.String delimiter,
                            int maxLength)
                            throws java.io.IOException,
                                   MaxReadSizeExceededException
read a byte array by using a delimiter For performance reasons, the ByteBuffer readByteBuffer method is generally preferable to get bytes

Parameters:
delimiter - the delimiter
maxLength - the max length of bytes that should be read. If the limit is exceeded a MaxReadSizeExceededException will been thrown
Returns:
the read bytes
Throws:
MaxReadSizeExceededException - If the max read length has been exceeded and the delimiter hasn’t been found
java.io.IOException - If some other I/O error occurs