Package org.simpleframework.transport
Interface ByteWriter
-
- All Known Implementing Classes:
TransportWriter
public interface ByteWriter
TheByteWriter
object is used to send data over the TCP transport. This provides direct contact with the connected socket. Delivery over a sender implementation can be either SSL based or direct. It is the responsibility of the implementation to provide such behavior as required.- Author:
- Niall Gallagher
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
This is used to close the sender and the underlying transport.void
flush()
This method is used to flush the contents of the buffer to the client.void
write(byte[] array)
This method is used to deliver the provided array of bytes to the underlying transport.void
write(byte[] array, int off, int len)
This method is used to deliver the provided array of bytes to the underlying transport.void
write(java.nio.ByteBuffer buffer)
This method is used to deliver the provided buffer of bytes to the underlying transport.void
write(java.nio.ByteBuffer buffer, int off, int len)
This method is used to deliver the provided buffer of bytes to the underlying transport.
-
-
-
Method Detail
-
write
void write(byte[] array) throws java.io.IOException
This method is used to deliver the provided array of bytes to the underlying transport. Depending on the connection type the array may be encoded for SSL transport or send directly. Any implementation may choose to buffer the bytes for performance.- Parameters:
array
- this is the array of bytes to send to the client- Throws:
java.io.IOException
-
write
void write(byte[] array, int off, int len) throws java.io.IOException
This method is used to deliver the provided array of bytes to the underlying transport. Depending on the connection type the array may be encoded for SSL transport or send directly. Any implementation may choose to buffer the bytes for performance.- Parameters:
array
- this is the array of bytes to send to the clientoff
- this is the offset within the array to send fromlen
- this is the number of bytes that are to be sent- Throws:
java.io.IOException
-
write
void write(java.nio.ByteBuffer buffer) throws java.io.IOException
This method is used to deliver the provided buffer of bytes to the underlying transport. Depending on the connection type the array may be encoded for SSL transport or send directly. Any implementation may choose to buffer the bytes for performance.- Parameters:
buffer
- this is the buffer of bytes to send to the client- Throws:
java.io.IOException
-
write
void write(java.nio.ByteBuffer buffer, int off, int len) throws java.io.IOException
This method is used to deliver the provided buffer of bytes to the underlying transport. Depending on the connection type the array may be encoded for SSL transport or send directly. Any implementation may choose to buffer the bytes for performance.- Parameters:
buffer
- this is the buffer of bytes to send to the clientoff
- this is the offset within the buffer to send fromlen
- this is the number of bytes that are to be sent- Throws:
java.io.IOException
-
flush
void flush() throws java.io.IOException
This method is used to flush the contents of the buffer to the client. This method will block until such time as all of the data has been sent to the client. If at any point there is an error sending the content an exception is thrown.- Throws:
java.io.IOException
-
close
void close() throws java.io.IOException
This is used to close the sender and the underlying transport. If a close is performed on the sender then no more bytes can be read from or written to the transport and the client will received a connection close on their side.- Throws:
java.io.IOException
-
-