public class FileUtil extends Object
Utility class for file operations
Copyright 2010 (C) by Martin Ganserer
| Modifier and Type | Method and Description |
|---|---|
static Byte[] |
convertToByteArray(byte[] array)
Convert a byte[] into a Byte[]
|
static byte[] |
convertToByteArray(Byte[] array)
Convert a given Byte[] into a byte[]
|
static void |
copyFile(File sourceFile,
File targetFile)
Copy file and replace target file if it already exists
|
static byte[] |
getBytesFromFile(File file)
Returns the contents of the file in a byte array
|
static String |
getUniqueFileName(String groupName)
Get unique file name to save file to central repository
|
public static void copyFile(File sourceFile, File targetFile) throws IOException
sourceFile - targetFile - IOException - if the copy operation has failedpublic static String getUniqueFileName(String groupName)
groupName - a token in order to distinguish between files that belong to different domain objectspublic static byte[] getBytesFromFile(File file) throws IOException
file - the file this method should read data fromIOException - if the content could not be readpublic static Byte[] convertToByteArray(byte[] array)
array - public static byte[] convertToByteArray(Byte[] array)
array - Copyright © 2018. All rights reserved.