Package gov.nih.mipav.model.file
Class MetadataExtractor.FileUtil
- java.lang.Object
-
- gov.nih.mipav.model.file.MetadataExtractor.FileUtil
-
- Enclosing class:
- MetadataExtractor
public static class MetadataExtractor.FileUtil extends java.lang.ObjectA series of utility methods for working with the file system. The methods herein are used in unit testing. Use them in production code at your own risk!- Author:
- Drew Noakes https://drewnoakes.com
-
-
Constructor Summary
Constructors Constructor Description FileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]readBytes(java.io.File file)Reads the contents of aFileinto abyte[].static byte[]readBytes(java.lang.String filePath)Reads the contents of aFileinto abyte[].static voidsaveBytes(java.io.File file, byte[] bytes)Saves the contents of abyte[]to the specifiedFile.
-
-
-
Method Detail
-
saveBytes
public static void saveBytes(java.io.File file, byte[] bytes) throws java.io.IOExceptionSaves the contents of abyte[]to the specifiedFile.- Throws:
java.io.IOException
-
readBytes
public static byte[] readBytes(java.io.File file) throws java.io.IOExceptionReads the contents of aFileinto abyte[]. This relies uponFile.length()returning the correct value, which may not be the case when using a network file system. However this method is intended for unit test support, in which case the files should be on the local volume.- Throws:
java.io.IOException
-
readBytes
public static byte[] readBytes(java.lang.String filePath) throws java.io.IOExceptionReads the contents of aFileinto abyte[]. This relies uponFile.length()returning the correct value, which may not be the case when using a network file system. However this method is intended for unit test support, in which case the files should be on the local volume.- Throws:
java.io.IOException
-
-