You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/05/21 15:02:42 UTC
svn commit: r408168 -
/jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/services/FileServer.java
Author: sebb
Date: Sun May 21 06:02:42 2006
New Revision: 408168
URL: http://svn.apache.org/viewvc?rev=408168&view=rev
Log:
Bug 39580 - Add recycle option (defaults to true)
Modified:
jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/services/FileServer.java
Modified: jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/services/FileServer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/services/FileServer.java?rev=408168&r1=408167&r2=408168&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/services/FileServer.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/services/FileServer.java Sun May 21 06:02:42 2006
@@ -112,14 +112,26 @@
}
}
- /**
+ /**
+ * Get the next line of the named file, recycle by default.
+ *
+ * @param filename
+ * @return String containing the next line in the file
+ * @throws IOException
+ */
+ public String readLine(String filename) throws IOException {
+ return readLine(filename, true);
+ }
+
+ /**
* Get the next line of the named file.
*
- * @param filename
- * @return
+ * @param filename
+ * @param recycle - should file be restarted at EOF?
+ * @return String containing the next line in the file (null if EOF reached and not recycle)
* @throws IOException
*/
- public synchronized String readLine(String filename) throws IOException {
+ public synchronized String readLine(String filename, boolean recycle) throws IOException {
FileEntry fileEntry = (FileEntry) files.get(filename);
if (fileEntry != null) {
if (fileEntry.inputOutputObject == null) {
@@ -130,7 +142,7 @@
}
BufferedReader reader = (BufferedReader) fileEntry.inputOutputObject;
String line = reader.readLine();
- if (line == null) {
+ if (line == null && recycle) {
reader.close();
reader = new BufferedReader(new FileReader(fileEntry.file));
fileEntry.inputOutputObject = reader;
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org