public class FileOperations
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
computeHash(java.io.File file)
Returns a string containing a 512bit hash in hexadecimal of the file.
|
static void |
dumpFile(java.io.InputStream inputStream,
javax.servlet.ServletOutputStream outputStream)
Reads from inputStream and dumps it to the outputStream.
|
static void |
outputImage(java.io.File file,
javax.servlet.ServletOutputStream outputStream,
java.lang.String size,
ImageAngle angle)
Writes an image to the outputStream that has been scaled appropriately and angled.
|
public static void dumpFile(java.io.InputStream inputStream, javax.servlet.ServletOutputStream outputStream) throws java.io.IOException
inputStream
- the inputoutputStream
- the outputjava.io.IOException
- an error occurred reading/writing to streamspublic static void outputImage(java.io.File file, javax.servlet.ServletOutputStream outputStream, java.lang.String size, ImageAngle angle) throws java.io.IOException
file
- original photograph, can only process images of type outputStream
- the outputstream to write the image tosize
- the size of the image, can be "thumb", "medium" or the default.java.io.IOException
- thrown when the file cannot be access in some way.public static java.lang.String computeHash(java.io.File file) throws java.security.NoSuchAlgorithmException, java.io.FileNotFoundException, java.io.IOException
file
- the file to hashjava.security.NoSuchAlgorithmException
- if SHA-512 is not supported (should be, though)java.io.FileNotFoundException
- if file is not found on the filesystemjava.io.IOException
- if an error occurred whilst reading the file.