org.apache.jmeter.services
Class FileServer
The point of this class is to provide thread-safe access to files, and to
provide some simplifying assumptions about where to find files and how to
name them. For instance, putting supporting files in the same directory as
the saved test plan file allows users to refer to the file with just it's
name - this FileServer class will find the file without a problem.
Eventually, I want all in-test file access to be done through here, with the
goal of packaging up entire test plans as a directory structure that can be
sent via rmi to remote servers (currently, one must make sure the remote
server has all support files in a relative-same location) and to package up
test plans to execute on unknown boxes that only have Java installed.
void | closeFile(String name)
|
void | closeFiles()
|
protected boolean | filesOpen()
|
String | getBaseDir()
|
static FileServer | getFileServer()
|
File | getRandomFile(String basedir, String[] extensions) - Method will get a random file in a base directory
TODO hey, not sure this method belongs here.
|
String | readLine(String filename) - Get the next line of the named file, recycle by default.
|
String | readLine(String filename, boolean recycle) - Get the next line of the named file.
|
void | reserveFile(String filename) - Creates an association between a filename and a File inputOutputObject,
and stores it for later use - unless it is already stored.
|
void | reserveFile(String filename, String charsetName) - Creates an association between a filename and a File inputOutputObject,
and stores it for later use - unless it is already stored.
|
void | reserveFile(String filename, String charsetName, String alias) - Creates an association between a filename and a File inputOutputObject,
and stores it for later use - unless it is already stored.
|
void | resetBase()
|
void | setBasedir(String basedir)
|
void | write(String filename, String value)
|
closeFile
public void closeFile(String name)
throws IOException
closeFiles
public void closeFiles()
throws IOException
filesOpen
protected boolean filesOpen()
getBaseDir
public String getBaseDir()
getFileServer
public static FileServer getFileServer()
getRandomFile
public File getRandomFile(String basedir,
String[] extensions)
Method will get a random file in a base directory
TODO hey, not sure this method belongs here. FileServer is for threadsafe
File access relative to current test's base directory.
- a random File from the basedir that matches one of the extensions
readLine
public String readLine(String filename)
throws IOException
Get the next line of the named file, recycle by default.
- String containing the next line in the file
readLine
public String readLine(String filename,
boolean recycle)
throws IOException
Get the next line of the named file.
filename
- recycle
- - should file be restarted at EOF?
- String containing the next line in the file (null if EOF reached and not recycle)
reserveFile
public void reserveFile(String filename)
Creates an association between a filename and a File inputOutputObject,
and stores it for later use - unless it is already stored.
filename
- - relative (to base) or absolute file name (must not be null)
reserveFile
public void reserveFile(String filename,
String charsetName)
Creates an association between a filename and a File inputOutputObject,
and stores it for later use - unless it is already stored.
filename
- - relative (to base) or absolute file name (must not be null)charsetName
- - the character set encoding to use for the file (may be null)
reserveFile
public void reserveFile(String filename,
String charsetName,
String alias)
Creates an association between a filename and a File inputOutputObject,
and stores it for later use - unless it is already stored.
filename
- - relative (to base) or absolute file name (must not be null)charsetName
- - the character set encoding to use for the file (may be null)alias
- - the name to be used to access the object (must not be null)
resetBase
public void resetBase()
throws IOException
setBasedir
public void setBasedir(String basedir)
throws IOException
write
public void write(String filename,
String value)
throws IOException
Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.