public class AttachmentStreamFactory
extends java.lang.Object
Constructor and Description |
---|
AttachmentStreamFactory(KeyProvider keyProvider)
Creates a factory Attachment objects can use to read/write attachments.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getInputStream(java.io.File file,
Attachment.Encoding encoding)
Return a stream to be used to read from the file on disk.
|
java.io.OutputStream |
getOutputStream(java.io.File file,
Attachment.Encoding encoding)
Get stream for writing attachment data to disk.
|
public AttachmentStreamFactory(KeyProvider keyProvider)
keyProvider
- Datastore's key provider object. This object can cope with key providers
that return null keys.public java.io.InputStream getInputStream(java.io.File file, Attachment.Encoding encoding) throws java.io.IOException
file
- File object to read from.encoding
- Encoding of attachment.java.io.IOException
- if there's a problem reading from disk, including issues with
encryption (bad key length and other key issues).public java.io.OutputStream getOutputStream(java.io.File file, Attachment.Encoding encoding) throws java.io.IOException
FileUtils.openOutputStream(File)
.
Data should be written to the stream unencoded, unencrypted.file
- File to write to.encoding
- Encoding to use.java.io.IOException
- if there's a problem writing to disk, including issues with
encryption (bad key length and other key issues).FileUtils.openOutputStream(File)