Class FileURLConnection


  • public class FileURLConnection
    extends java.net.URLConnection
    Provides local file access via URL semantics, correctly returning the last modified time of the underlying file.
    Version:
    $Revision$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static boolean decodeFilePaths  
      protected java.io.File file
      The underlying file
      (package private) static boolean useURI  
      • Fields inherited from class java.net.URLConnection

        allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
    • Constructor Summary

      Constructors 
      Constructor Description
      FileURLConnection​(java.net.URL url)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void connect()
      Checks if the underlying file for this connection exists.
      java.io.File getFile()
      Returns the underlying file for this connection.
      java.lang.String getHeaderField​(java.lang.String name)
      Provides support for the following headers: last-modified content-length content-type date
      java.io.InputStream getInputStream()  
      long getLastModified()
      Returns the last modified time of the underlying file.
      java.io.OutputStream getOutputStream()  
      java.security.Permission getPermission()
      Return a permission for reading of the file
      • Methods inherited from class java.net.URLConnection

        addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • decodeFilePaths

        static boolean decodeFilePaths
      • useURI

        static boolean useURI
      • file

        protected final java.io.File file
        The underlying file
    • Constructor Detail

      • FileURLConnection

        public FileURLConnection​(java.net.URL url)
                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getFile

        public java.io.File getFile()
        Returns the underlying file for this connection.
        Returns:
        the file
      • connect

        public void connect()
                     throws java.io.IOException
        Checks if the underlying file for this connection exists.
        Specified by:
        connect in class java.net.URLConnection
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Overrides:
        getInputStream in class java.net.URLConnection
        Throws:
        java.io.IOException
      • getOutputStream

        public java.io.OutputStream getOutputStream()
                                             throws java.io.IOException
        Overrides:
        getOutputStream in class java.net.URLConnection
        Throws:
        java.io.IOException
      • getHeaderField

        public java.lang.String getHeaderField​(java.lang.String name)
        Provides support for the following headers: last-modified content-length content-type date
        Overrides:
        getHeaderField in class java.net.URLConnection
      • getPermission

        public java.security.Permission getPermission()
                                               throws java.io.IOException
        Return a permission for reading of the file
        Overrides:
        getPermission in class java.net.URLConnection
        Throws:
        java.io.IOException
      • getLastModified

        public long getLastModified()
        Returns the last modified time of the underlying file.
        Overrides:
        getLastModified in class java.net.URLConnection