org.easetech.easytest.io
Class UrlResource

java.lang.Object
  extended by org.easetech.easytest.io.UrlResource
All Implemented Interfaces:
Resource

public class UrlResource
extends Object
implements Resource

A Resource implementation for the URL based resources.

Author:
Anuj Kumar

Constructor Summary
UrlResource(String path)
          Construct a new UrlResource from the given path
UrlResource(URL url)
          Construct a new UrlResource from the given URL
 
Method Summary
 boolean exists()
          Checks whether the URL resource exists or not.
 File getFile()
          Get the File associated with the resource
 InputStream getInputStream()
          Get the input stream associated with the resource
 OutputStream getOutputStream()
          Get the OutputStream associated with the resource
 String getPath()
           
 String getResourceName()
          Get the resource name
 URL getURL()
          Get the URL associated with the resource
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UrlResource

public UrlResource(String path)
            throws MalformedURLException
Construct a new UrlResource from the given path

Parameters:
path -
Throws:
MalformedURLException

UrlResource

public UrlResource(URL url)
Construct a new UrlResource from the given URL

Parameters:
url -
Method Detail

getPath

public String getPath()
Returns:
the path

exists

public boolean exists()
Checks whether the URL resource exists or not.

Specified by:
exists in interface Resource
Returns:

getInputStream

public InputStream getInputStream()
                           throws IOException
Get the input stream associated with the resource

Specified by:
getInputStream in interface Resource
Returns:
input stream associated with the resource
Throws:
IOException

getURL

public URL getURL()
Get the URL associated with the resource

Specified by:
getURL in interface Resource
Returns:
the URL associated with the resource

getFile

public File getFile()
             throws Exception
Get the File associated with the resource

Specified by:
getFile in interface Resource
Returns:
the File associated with the resource
Throws:
Exception

getResourceName

public String getResourceName()
Get the resource name

Specified by:
getResourceName in interface Resource
Returns:

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Get the OutputStream associated with the resource

Specified by:
getOutputStream in interface Resource
Returns:
OutputStream
Throws:
IOException - if an IOException occurs

toString

public String toString()
Overrides:
toString in class Object
Returns:


Copyright © 2013. All Rights Reserved.