文档介绍:作者:asp3000 email: coolknight@ 日期:2000-8-8 12:00:20 jsp文件操作之读取篇(本站文章) 转载请注明来源来源 jsp中国论坛 http://jspbbs.
Contents of the file:
<% int count = 0; %> <% while (() != -1) { %> <% count++; %> Line <% (count); %>: <% (()); %>
<% } %>
import .*; import ; public class DelimitedDataFile { /** * * Written by Morgan Catlin Email: ******@ * April 6, 1999 * * Variables: * String currentRecord = the record the bean is currently working on * BufferedReader file = the file the bean is working with * String path = the path to the file (ie. /home/you/) * StringTokenizer token = the currentRecord tokenized * * Methods: * public void setPath() - creates a BufferedReader that reads the file in path * public String getPath() - returns path * public void fileClose() - closes the file that is being read * public int nextRecord() - reads the next record(line) in the file, * and returns the number of tokens in the record * or else returns -1 if there aren't anymore records * public double returnDouble() - returns the next token as a double * public int returnInt() - returns the next token as an int * public String returnString() - returns the next token as a String * public String returnRecord() - returns the entire record as a String */ private String