Class MetadataExtractor.FileUtil

java.lang.Object
gov.nih.mipav.model.file.MetadataExtractor.FileUtil
Enclosing class:
MetadataExtractor

public static class MetadataExtractor.FileUtil extends 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 Details

    • FileUtil

      public FileUtil()
  • Method Details

    • saveBytes

      public static void saveBytes(File file, byte[] bytes) throws IOException
      Saves the contents of a byte[] to the specified File.
      Throws:
      IOException
    • readBytes

      public static byte[] readBytes(File file) throws IOException
      Reads the contents of a File into a byte[]. This relies upon File.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:
      IOException
    • readBytes

      public static byte[] readBytes(String filePath) throws IOException
      Reads the contents of a File into a byte[]. This relies upon File.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:
      IOException