public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
checksum(File file,
String algorithm)
Calculates and returns a checksum for the passed file using the passed
algorithm.
|
static String |
checksum(InputStream in,
String algorithm)
Calculates and returns a checksum for the passed IO stream using the passed
algorithm.
|
static void |
copy(File inFile,
File outFile)
Performs a buffered copy from one file into another.
|
static void |
copy(InputStream in,
OutputStream out)
Performs a buffered copy from one IO stream into another.
|
static String |
toHex(byte[] data) |
public static String checksum(File file, String algorithm) throws IOException
file - file on which to calculate checksumalgorithm - string for algorithm: 'MD5', 'SHA1', etcIOException - if IO errorpublic static String checksum(InputStream in, String algorithm) throws IOException
in - input stream on which to calculate checksumalgorithm - string for algorithm: 'MD5', 'SHA1', etcIOException - if IO errorpublic static String toHex(byte[] data)
public static void copy(File inFile, File outFile) throws IOException
inFile - outFile - IOException - if IO errorpublic static void copy(InputStream in, OutputStream out) throws IOException
in - input streamout - output streamIOException - if IO errorCopyright © 2022 LYRASIS. All rights reserved.