Class FileTools


  • public class FileTools
    extends java.lang.Object
    Provides common file tools useful for braille.
    Author:
    Joel HÃ¥kansson
    • Constructor Summary

      Constructors 
      Constructor Description
      FileTools()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void copy​(java.io.InputStream is, java.io.OutputStream os)
      Copies an input stream to an output stream
      static java.io.File[] listFiles​(java.io.File dir, java.lang.String ext)
      Lists files in a directory with a given extension.
      static java.net.URL[] toURL​(java.io.File[] files)
      Converts an array of File objects into URL's
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileTools

        public FileTools()
    • Method Detail

      • copy

        public static void copy​(java.io.InputStream is,
                                java.io.OutputStream os)
                         throws java.io.IOException
        Copies an input stream to an output stream
        Parameters:
        is - the input stream
        os - the output stream
        Throws:
        java.io.IOException - if IO fails
      • listFiles

        public static java.io.File[] listFiles​(java.io.File dir,
                                               java.lang.String ext)
        Lists files in a directory with a given extension.
        Parameters:
        dir - the directory to list files in
        ext - the extension to test
        Returns:
        returns an array of files with the specified extension
      • toURL

        public static java.net.URL[] toURL​(java.io.File[] files)
        Converts an array of File objects into URL's
        Parameters:
        files - the files to convert
        Returns:
        returns an array of URL's