org.easetech.easytest.io
Class FileSystemResource

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

public class FileSystemResource
extends Object
implements Resource

A FileSystem based Resource implementation. The ResourceLoaderStrategy will auto instantiate this class if the DataLoader annotation specifies the filePaths attribute to contain a FileSystem resource. For eg.
@DataLoader(filePahts={C:\\myComputer\\testData.csv})

Author:
Anuj Kuamr

Constructor Summary
FileSystemResource(File file)
          Construct a new FileSystemResource from the provided File instance
FileSystemResource(String path)
          Construct a new FileSystemResource from the provided simple path
 
Method Summary
 boolean exists()
          Identifies whether the resource represented by this instance exists or not
 File getFile()
          Get the File object instance represented by this Resource
 InputStream getInputStream()
          Get the input stream represented by this resource
 OutputStream getOutputStream()
          Get the OutputStream for the given resource
 String getPath()
           
 String getResourceName()
          Return the name of the resource
 URL getURL()
          Gwet the URL represented by this resource
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileSystemResource

public FileSystemResource(String path)
Construct a new FileSystemResource from the provided simple path

Parameters:
path - the path where the file system resource resides

FileSystemResource

public FileSystemResource(File file)
Construct a new FileSystemResource from the provided File instance

Parameters:
file - representing the file system resource
Method Detail

getPath

public String getPath()
Returns:
the path

exists

public boolean exists()
Identifies whether the resource represented by this instance exists or not

Specified by:
exists in interface Resource
Returns:
boolean

getInputStream

public InputStream getInputStream()
Get the input stream represented by this resource

Specified by:
getInputStream in interface Resource
Returns:
InputStream

getURL

public URL getURL()
Gwet the URL represented by this resource

Specified by:
getURL in interface Resource
Returns:
URL instance

getFile

public File getFile()
Get the File object instance represented by this Resource

Specified by:
getFile in interface Resource
Returns:
File instance

getResourceName

public String getResourceName()
Return the name of the resource

Specified by:
getResourceName in interface Resource
Returns:
resource name

getOutputStream

public OutputStream getOutputStream()
Get the OutputStream for the given resource

Specified by:
getOutputStream in interface Resource
Returns:
OutputStream

toString

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


Copyright © 2013. All Rights Reserved.