public class ByteArrayContentSource extends AbstractContentSource
ContentSource with Byte array as source of the content bytes.BUFFER_SIZE| Constructor and Description |
|---|
ByteArrayContentSource(byte[] content) |
ByteArrayContentSource(int length) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addContent(byte[] arr,
int offset,
int length)
Add content to this
ByteArrayContentSource |
long |
getLength() |
long |
writeTo(OutputStream stream)
Write this content to a
OutputStream instance. |
long |
writeTo(Socket socket)
Write this content on to a network socket
|
long |
writeTo(SocketChannel channel)
Write this content on to a
SocketChannel |
public ByteArrayContentSource(int length)
public ByteArrayContentSource(byte[] content)
public long getLength()
public long writeTo(Socket socket) throws IOException
ContentSourcesocket - socketIOException - IOExceptionpublic long writeTo(SocketChannel channel) throws IOException
ContentSourceSocketChannelchannel - channelIOException - IOExceptionpublic long writeTo(OutputStream stream) throws IOException
ContentSourceOutputStream instance.stream - streamIOException - IOExceptionpublic boolean addContent(byte[] arr,
int offset,
int length)
ByteArrayContentSourcearr - array oof contentoffset - starting indexlength - number of bytes to be addedContentSource;
false if the internal array didnt have enough spaceCopyright © 2019. All rights reserved.