org.openqa.selenium.server
Class ClassPathResource

java.lang.Object
  extended by org.openqa.jetty.util.Resource
      extended by org.openqa.selenium.server.ClassPathResource
All Implemented Interfaces:
java.io.Serializable

public class ClassPathResource
extends Resource

Represents resource file off of the classpath.

Author:
Patrick Lightbody (plightbo at gmail dot com)
See Also:
Serialized Form

Constructor Summary
ClassPathResource(java.lang.String path)
          Specifies the classpath path containing the resource
 
Method Summary
 Resource addPath(java.lang.String pathParm)
          Returns the resource contained inside the current resource with the given name.
 boolean delete()
          Deletes the given resource
 boolean exists()
          Returns true if the respresened resource exists.
 java.lang.Object getAssociate()
           
 java.io.File getFile()
          Returns an File representing the given resource or NULL if this is not possible.
 java.io.InputStream getInputStream()
          Returns an input stream to the resource
 java.lang.String getName()
          Returns the name of the resource
 java.io.OutputStream getOutputStream()
          Returns an output stream to the resource
 java.net.URL getURL()
          Returns an URL representing the given resource
 boolean isDirectory()
          Returns true if the respresenetd resource is a container/directory.
 long lastModified()
          Returns the lastModified time, which is always in the distant future to prevent caching.
 long length()
          Return the length of the resource
 java.lang.String[] list()
          Returns a list of resource names contained in the given resource The resource names are not URL encoded.
 void release()
          Release any resources held by the resource.
 boolean renameTo(Resource dest)
          Rename the given resource
 java.lang.String toString()
           
 
Methods inherited from class org.openqa.jetty.util.Resource
cache, encode, finalize, getAlias, getListHTML, newResource, newResource, newSystemResource, setAssociate, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassPathResource

public ClassPathResource(java.lang.String path)
Specifies the classpath path containing the resource

Method Detail

getAssociate

public java.lang.Object getAssociate()
Overrides:
getAssociate in class Resource

release

public void release()
Description copied from class: Resource
Release any resources held by the resource.

Specified by:
release in class Resource

exists

public boolean exists()
Description copied from class: Resource
Returns true if the respresened resource exists.

Specified by:
exists in class Resource

isDirectory

public boolean isDirectory()
Description copied from class: Resource
Returns true if the respresenetd resource is a container/directory. If the resource is not a file, resources ending with "/" are considered directories.

Specified by:
isDirectory in class Resource

lastModified

public long lastModified()
Returns the lastModified time, which is always in the distant future to prevent caching.

Specified by:
lastModified in class Resource

length

public long length()
Description copied from class: Resource
Return the length of the resource

Specified by:
length in class Resource

getURL

public java.net.URL getURL()
Description copied from class: Resource
Returns an URL representing the given resource

Specified by:
getURL in class Resource

getFile

public java.io.File getFile()
                     throws java.io.IOException
Description copied from class: Resource
Returns an File representing the given resource or NULL if this is not possible.

Specified by:
getFile in class Resource
Throws:
java.io.IOException

getName

public java.lang.String getName()
Description copied from class: Resource
Returns the name of the resource

Specified by:
getName in class Resource

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from class: Resource
Returns an input stream to the resource

Specified by:
getInputStream in class Resource
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException,
                                            java.lang.SecurityException
Description copied from class: Resource
Returns an output stream to the resource

Specified by:
getOutputStream in class Resource
Throws:
java.io.IOException
java.lang.SecurityException

delete

public boolean delete()
               throws java.lang.SecurityException
Description copied from class: Resource
Deletes the given resource

Specified by:
delete in class Resource
Throws:
java.lang.SecurityException

renameTo

public boolean renameTo(Resource dest)
                 throws java.lang.SecurityException
Description copied from class: Resource
Rename the given resource

Specified by:
renameTo in class Resource
Throws:
java.lang.SecurityException

list

public java.lang.String[] list()
Description copied from class: Resource
Returns a list of resource names contained in the given resource The resource names are not URL encoded.

Specified by:
list in class Resource

addPath

public Resource addPath(java.lang.String pathParm)
                 throws java.io.IOException,
                        java.net.MalformedURLException
Description copied from class: Resource
Returns the resource contained inside the current resource with the given name.

Specified by:
addPath in class Resource
Parameters:
pathParm - The path segment to add, which should be encoded by the encode method.
Throws:
java.io.IOException
java.net.MalformedURLException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011. All Rights Reserved.