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.Object
A 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 aFile
into abyte[]
.static byte[]
readBytes(java.lang.String filePath)
Reads the contents of aFile
into abyte[]
.static void
saveBytes(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.IOException
Saves the contents of abyte[]
to the specifiedFile
.- Throws:
java.io.IOException
-
readBytes
public static byte[] readBytes(java.io.File file) throws java.io.IOException
Reads the contents of aFile
into 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.IOException
Reads the contents of aFile
into 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
-
-