Class DittoAttachment
java.lang.Object
com.ditto.java.DittoAttachment
- All Implemented Interfaces:
Closeable,AutoCloseable
Represents an attachment
and can be used to insert the associated attachment into a document at a specific key.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcopyToPath(@NonNull String path) Copies the attachment to the specified file path.booleanbyte[]getData()Returns the attachment's data as aByteArray.@NonNull StringgetId()Returns the attachment's ID.@NonNull FileInputStreamReturns an input stream for the attachment file.@NonNull DittoULongReturns the length (size) of the attachment.@NonNull DittoCborSerializable.DictionaryReturns the attachment's metadata.inthashCode()toString()
-
Method Details
-
getId
Returns the attachment's ID.- Returns:
- the attachment's unique identifier.
-
getLength
Returns the length (size) of the attachment.- Returns:
- the attachment's length in bytes.
-
getMetadata
Returns the attachment's metadata.- Returns:
- a
DittoCborSerializable.Dictionarycontaining the attachment's metadata.
-
getData
public byte[] getData()Returns the attachment's data as aByteArray.- Returns:
- the attachment's data.
-
getInputStream
Returns an input stream for the attachment file.- Returns:
- an input stream for the attachment file.
-
copyToPath
Copies the attachment to the specified file path.- Parameters:
path- the path that the attachment should be copied to.- Throws:
DittoException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
hashCode
-
equals
-
toString
-