public class FileManipulation extends Object
Constructor and Description |
---|
FileManipulation() |
Modifier and Type | Method and Description |
---|---|
static void |
addDirectory(File directory)
Utility method for creation of directory
|
static BufferedImage |
bitmapToImage(InputStream is,
String format)
Utility method to read image from disk and transform image to BufferedImage object
|
static void |
copyDirectory(File srcDir,
File dstDir)
Utility method for copying directory
|
static void |
copyFile(File srcFile,
File destFile)
Utility method for copying file
|
static boolean |
deleteDirectory(File dir,
boolean isInitialDelete)
Utility method for delete directory
|
static void |
deleteFile(File file)
Utility method for delete file
|
static BufferedImage |
getScaledInstance(BufferedImage img,
int targetWidth,
int targetHeight,
Object hint,
boolean higherQuality)
Convenience method that returns a scaled instance of the provided
BufferedImage . |
static void |
imageToBitmap(BufferedImage image,
String data,
String format)
Utility method to write BufferedImage object to disk
|
static String |
joinFiles(String... files)
Utility method for concatenation names of collection of files
|
public static void copyFile(File srcFile, File destFile) throws IOException
srcFile
- - source filedestFile
- - destination fileIOException
public static void copyDirectory(File srcDir, File dstDir) throws IOException
srcDir
- - source directorydstDir
- - destination directoryIOException
public static boolean deleteDirectory(File dir, boolean isInitialDelete)
dir
- - directory to deleteisInitialDelete
- - determine if the deleting process running at startup or on destroy of applicationpublic static String joinFiles(String... files)
files
- - array of strings to concatenatepublic static void deleteFile(File file)
file
- - file to deletepublic static BufferedImage bitmapToImage(InputStream is, String format) throws IOException
data
- - relative path to the imageformat
- - file prefix of the imageIOException
public static void imageToBitmap(BufferedImage image, String data, String format) throws IOException
image
- - BufferedImage object to save.data
- - relative path to the imageformat
- - file prefix of the imageIOException
public static BufferedImage getScaledInstance(BufferedImage img, int targetWidth, int targetHeight, Object hint, boolean higherQuality)
BufferedImage
.img
- the original image to be scaledtargetWidth
- the desired width of the scaled instance, in pixelstargetHeight
- the desired height of the scaled instance, in pixelshint
- one of the rendering hints that corresponds to RenderingHints.KEY_INTERPOLATION
(e.g.
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
, RenderingHints.VALUE_INTERPOLATION_BILINEAR
,
RenderingHints.VALUE_INTERPOLATION_BICUBIC
)higherQuality
- if true, this method will use a multi-step scaling technique that provides higher quality than the
usual one-step technique (only useful in downscaling cases, where targetWidth
or targetHeight
is
smaller than the original dimensions, and generally only when the BILINEAR
hint is specified)BufferedImage
public static void addDirectory(File directory)
directory
- - directory to createCopyright © 2015. All rights reserved.