org.openide.execution
Class NbfsURLConnection

java.lang.Object
  |
  +--java.net.URLConnection
        |
        +--org.openide.execution.NbfsURLConnection

public final class NbfsURLConnection
extends URLConnection

Special URL connection directly accessing an internal file object.


Field Summary
static String PROTOCOL
          Protocol name for this type of URL.
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
NbfsURLConnection(URL u)
          Create a new connection to a FileObject.
 
Method Summary
 void connect()
           
static FileObject decodeURL(URL u)
          Retrieves the file object specified by an internal URL.
static URL encodeFileObject(FileObject fo)
          Provides a URL to access a file object.
 int getContentLength()
           
 String getHeaderField(String name)
          Get a header field (currently, content type only).
 InputStream getInputStream()
           
 OutputStream getOutputStream()
           
 Permission getPermission()
           
 
Methods inherited from class java.net.URLConnection
getAllowUserInteraction, getContent, getContent, getContentEncoding, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getIfModifiedSince, getLastModified, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOCOL

public static final String PROTOCOL
Protocol name for this type of URL.
Constructor Detail

NbfsURLConnection

public NbfsURLConnection(URL u)
Create a new connection to a FileObject.
Parameters:
u - URL of the connection. Please use encodeFileObject(FileObject) to create the URL.
Method Detail

encodeFileObject

public static URL encodeFileObject(FileObject fo)
                            throws FileStateInvalidException
Provides a URL to access a file object.
Parameters:
fo - the file object
Returns:
a URL using the correct syntax and protocol
Throws:
FileStateInvalidException - if the file object is not valid (typically, if its filesystem is inconsistent or no longer present)

decodeURL

public static FileObject decodeURL(URL u)
Retrieves the file object specified by an internal URL.
Parameters:
u - the url to decode
Returns:
the file object that is represented by the URL, or null if the URL is somehow invalid or the file does not exist

connect

public void connect()
             throws IOException
Overrides:
connect in class URLConnection

getInputStream

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

getOutputStream

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

getContentLength

public int getContentLength()
Overrides:
getContentLength in class URLConnection

getHeaderField

public String getHeaderField(String name)
Get a header field (currently, content type only).
Overrides:
getHeaderField in class URLConnection
Parameters:
name - the header name. Only content-type is guaranteed to be present.
Returns:
the value (i.e., MIME type)

getPermission

public Permission getPermission()
                         throws IOException
Overrides:
getPermission in class URLConnection


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.