|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.placidus.file.FileHelper
public class FileHelper
Contains helperfunctions for File
Constructor Summary | |
---|---|
FileHelper()
|
Method Summary | |
---|---|
static long |
getAdlerSum(java.lang.String fileName)
|
static long |
getCheckSum(java.lang.String fileName,
java.util.zip.Checksum checkSum)
This will calculate the given checksumtype of the filecontent for the given name |
static long |
getCRC32Sum(java.lang.String fileName)
|
static java.io.File |
getFileForName(java.lang.String filename)
This function creates a File object for the given filename with different methods to load it. |
static java.lang.String |
getTempDir()
Returns the temp-dir from system property "java.io.tmpdir". |
static java.io.File |
save(java.io.File file,
byte[] toSave)
Used to save given bytes to given file object |
static java.io.File |
save(java.lang.String fileName,
byte[] toSave)
This function saves the given bytes into the given filename |
static java.io.File |
saveToTempDir(java.lang.String fileName,
byte[] toSave)
Saves the given byte array to filename in tempfolder |
static java.io.File |
saveToTempFile(java.lang.String prefix,
java.lang.String suffix,
byte[] toSave)
Saves the given byte array to filename in tempfolder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileHelper()
Method Detail |
---|
public static java.io.File getFileForName(java.lang.String filename) throws java.io.IOException, java.net.URISyntaxException
StreamHelper.getInputStreamForName(String)
filename
- of new fileobject
java.io.IOException
java.net.URISyntaxException
- if URL from resource is not formatted strictly according to to RFC2396 and cannot be converted to a URIpublic static java.io.File saveToTempDir(java.lang.String fileName, byte[] toSave) throws java.io.IOException
fileName
- filename to use in tempfoldertoSave
- bytes to save
java.io.IOException
public static java.io.File saveToTempFile(java.lang.String prefix, java.lang.String suffix, byte[] toSave) throws java.io.IOException
prefix
- filename partsuffix
- suffix parttoSave
- bytes to save
java.io.IOException
public static java.io.File save(java.lang.String fileName, byte[] toSave) throws java.io.IOException
fileName
- file to savetoSave
- content to save
java.io.IOException
public static java.io.File save(java.io.File file, byte[] toSave) throws java.io.IOException
file
- to save totoSave
- to save
java.io.IOException
public static long getCRC32Sum(java.lang.String fileName) throws java.io.IOException, java.net.URISyntaxException
java.io.IOException
java.net.URISyntaxException
with checksum = new CRC32
public static long getAdlerSum(java.lang.String fileName) throws java.io.IOException, java.net.URISyntaxException
java.io.IOException
java.net.URISyntaxException
with checksum = new Adler32
public static long getCheckSum(java.lang.String fileName, java.util.zip.Checksum checkSum) throws java.io.IOException, java.net.URISyntaxException
fileName
- to load and build checksum forcheckSum
- checksum object to build sum
java.io.IOException
- content can not be read
java.net.URISyntaxException
- if uri of fileName is not well formedpublic static java.lang.String getTempDir()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |