Class FileUtils


  • public class FileUtils
    extends Object
    Utils for handling files
    • Constructor Detail

      • FileUtils

        public FileUtils()
    • Method Detail

      • resourceAsByteArray

        public static byte[] resourceAsByteArray​(String path)
                                          throws IOException
        Get classpath resource as byte array
        Parameters:
        path - the path of the resource
        Returns:
        the byte array of the resource
        Throws:
        IOException - if the resource cannot be read
      • resourceAsFile

        public static Optional<File> resourceAsFile​(String name)
        Get classpath resource as file
        Parameters:
        name - the name of the resource
        Returns:
        the resource file, or Optional.EMPTY
      • resourceAsStream

        public static Optional<InputStream> resourceAsStream​(String name)
        Get classpath resource as file
        Parameters:
        name - the name of the resource
        Returns:
        the resource file, or Optional.EMPTY
      • classLoader

        public static ClassLoader classLoader()
        Get current class loader
        Returns:
        the current class loader