Class FileHandler


  • public class FileHandler
    extends URLStreamHandler
    This is the handler that is responsible for reading files from the file system.
    • Constructor Detail

      • FileHandler

        public FileHandler()
    • Method Detail

      • openConnection

        public URLConnection openConnection​(URL url)
                                     throws IOException
        Returns a connection to the a file pointed by this URL in the file system
        Specified by:
        openConnection in class URLStreamHandler
        Parameters:
        url - URL The URL to which the connection is pointing to
        Returns:
        A connection to the resource pointed by this url.
        Throws:
        IOException - if an I/O error occurs during opening the connection.
      • parseURL

        protected void parseURL​(URL url,
                                String spec,
                                int start,
                                int end)
        Parse the stringstr into URL u which already have the context properties. The string generally have the following format:
        /c:/windows/win.ini
        .
        Overrides:
        parseURL in class URLStreamHandler
        Parameters:
        url - The URL object that's parsed into
        spec - The string equivalent of the specification URL
        start - The index in the spec string from which to begin parsing
        end - The index to stop parsing
        See Also:
        URLStreamHandler.toExternalForm(URL), URL