public interface Data

Known subtypesData.ByteData, Data.FileData, Data.StorageData, Data.StringData

An interface that can be implemented by any object to allow it to be treated as data. Data has a size, and can be appended to an OutputStream. It is useful primarily for adding a custom body to a ConnectionRequest.

Nested types

class Data.StringData
class Data.FileDataWraps a File as a Data object.
class Data.StorageDataWraps a Storage object as a Data object.
class Data.ByteDataWraps a byte[] array as a Data object.

Methods

public abstract void appendTo(OutputStream output) throws IOExceptionAppends the data’s content to an output stream.
public abstract long getSize() throws IOExceptionGets the size of the data content.

Method details

appendTo

public abstract void appendTo(OutputStream output) throws IOException
Appends the data’s content to an output stream.

Parameters

output OutputStream
The output stream to append to.

getSize

public abstract long getSize() throws IOException
Gets the size of the data content.

Returns

Size of content in bytes.