public class EncodedImageSink
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying
OutputStream if the EncodedImageSink owns it. |
static EncodedImageSink |
from(java.io.File file)
Creates an
EncodedImageSink for the given file. |
static EncodedImageSink |
from(java.io.OutputStream outputStream)
Creates an
EncodedImageSink for the given OutputStream. |
static EncodedImageSink |
from(java.lang.String filePath)
Creates an
EncodedImageSink for the given file. |
java.io.OutputStream |
getOutputStream()
Returns the underlying
OutputStream |
java.lang.String |
toString() |
public static EncodedImageSink from(java.io.File file) throws java.io.FileNotFoundException
EncodedImageSink for the given file.file - The file to write tojava.io.FileNotFoundException - If the file cannot be createdpublic static EncodedImageSink from(java.lang.String filePath) throws java.io.FileNotFoundException
EncodedImageSink for the given file.filePath - The file to write tojava.io.FileNotFoundException - If the file cannot be createdpublic static EncodedImageSink from(java.io.OutputStream outputStream)
EncodedImageSink for the given OutputStream.outputStream - to write to; the caller keeps ownership of the OutputStream and is
responsible to properly close it.public java.io.OutputStream getOutputStream()
OutputStreampublic void close()
throws java.io.IOException
OutputStream if the EncodedImageSink owns it.close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object