ar.com.hjg.pngj
Class FileHelper
java.lang.Object
ar.com.hjg.pngj.FileHelper
public class FileHelper
- extends java.lang.Object
A few static utility methods related with PngReader/PngWriter that read/writes to files.
This is not essential to the PNGJ library, and the writer will not work in sandboxed environments (eg. Google App
Engine)
Method Summary |
static PngReader |
createPngReader(java.io.File file)
|
static PngWriter |
createPngWriter(java.io.File file,
ImageInfo imgInfo,
boolean allowOverwrite)
WARNING: This will throw exception if run in a sandboxed environment (as Google App Engine) that does not
permit to use Java class java.io.FileOutputStream. |
static java.io.InputStream |
openFileForReading(java.io.File file)
|
static java.io.OutputStream |
openFileForWriting(java.io.File file,
boolean allowOverwrite)
WARNING: This method will throw exception if run in a sandboxed environment (as Google App Engine) that does not
permit to use Java class java.io.FileOutputStream
We use reflection to be sure that this just throw run time exception in that case, but that the class is loadable |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileHelper
public FileHelper()
createPngReader
public static PngReader createPngReader(java.io.File file)
createPngWriter
public static PngWriter createPngWriter(java.io.File file,
ImageInfo imgInfo,
boolean allowOverwrite)
- WARNING: This will throw exception if run in a sandboxed environment (as Google App Engine) that does not
permit to use Java class java.io.FileOutputStream. You can always use the PngWriter constructor with
an arbitrary OutputStream
- Parameters:
file
- File to be writenimgInfo
- Target image basic infoallowOverwrite
- if true, file will be overwriten if it already exists.
- Returns:
- a new PngWriter - see constructor doc
openFileForReading
public static java.io.InputStream openFileForReading(java.io.File file)
openFileForWriting
public static java.io.OutputStream openFileForWriting(java.io.File file,
boolean allowOverwrite)
- WARNING: This method will throw exception if run in a sandboxed environment (as Google App Engine) that does not
permit to use Java class java.io.FileOutputStream
We use reflection to be sure that this just throw run time exception in that case, but that the class is loadable
- Parameters:
file
- allowOverwrite
-
- Returns:
- outputStream (should be of type FileOutputStream)