JBoss Common Classes 2.2.17.GA

org.jboss.net.protocol.file
Class FileURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.jboss.net.protocol.file.FileURLConnection

public class FileURLConnection
extends URLConnection

Provides local file access via URL semantics, correctly returning the last modified time of the underlying file.

Version:
$Revision: 2866 $
Author:
Jason Dillon, Scott Stark, Dimitris Andreadis

Field Summary
protected  File file
          The underlying file
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
FileURLConnection(URL url)
           
 
Method Summary
 void connect()
          Checks if the underlying file for this connection exists.
 File getFile()
          Returns the underlying file for this connection.
 String getHeaderField(String name)
          Provides support for the following headers: last-modified content-length content-type date
 InputStream getInputStream()
           
 long getLastModified()
          Returns the last modified time of the underlying file.
 OutputStream getOutputStream()
           
 Permission getPermission()
          Return a permission for reading of the file
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, 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

file

protected File file
The underlying file

Constructor Detail

FileURLConnection

public FileURLConnection(URL url)
                  throws MalformedURLException,
                         IOException
Throws:
MalformedURLException
IOException
Method Detail

getFile

public File getFile()
Returns the underlying file for this connection.

Returns:
the file

connect

public void connect()
             throws IOException
Checks if the underlying file for this connection exists.

Specified by:
connect in class URLConnection
Throws:
FileNotFoundException
IOException

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class URLConnection
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Overrides:
getOutputStream in class URLConnection
Throws:
IOException

getHeaderField

public String getHeaderField(String name)
Provides support for the following headers: last-modified content-length content-type date

Overrides:
getHeaderField in class URLConnection

getPermission

public Permission getPermission()
                         throws IOException
Return a permission for reading of the file

Overrides:
getPermission in class URLConnection
Throws:
IOException

getLastModified

public long getLastModified()
Returns the last modified time of the underlying file.

Overrides:
getLastModified in class URLConnection

JBoss Common Classes 2.2.17.GA

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.