Article View: borland.public.jbuilder.java.language
Article #18092file io
From: David Clark
Date: Wed, 19 Aug 1998 00:00
Date: Wed, 19 Aug 1998 00:00
57 lines
2415 bytes
2415 bytes
--------------072A26FE87CFEC73A0C932DF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I have a file called "uwi.lst" at c:\ that I would like to read from and
append to a StringBuffer. But when I try the following I get numbers
(ie:32 32 46... ):
theFile = new File("C:/uwi.lst");
in = new FileInputStream(theFile);
ReportStuff - new StringBuffer();
int c;
while ((c = in.read()) != -1)
{
reportStuff.append(in.read());
}
System.out.println( reportStuff);
When I try and use it as a RandomAccessFile or SequentialFile I get
output of question marks (ie: ??????????????????).
I would greatly appreciate any help you can offer. I know that it is
reading the file, but the am uncertain of why it is giving me that
characters it is. Do I need to convert them or something?
--------------072A26FE87CFEC73A0C932DF
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
I have a file called "uwi.lst" at c:\ that I would like to read from and
append to a StringBuffer. But when I try the following I get numbers
(ie:32 32 46... ):
<BR>
<BLOCKQUOTE>theFile = new File("C:/uwi.lst");
<BR>in = new FileInputStream(theFile);
<BR>ReportStuff - new StringBuffer();
<BR> int c;
<BR> while ((c = in.read()) != -1)
<BR> {
<BR> reportStuff.append(in.read());
<BR> }
<BR> System.out.println( reportStuff);
<BR> </BLOCKQUOTE>
When I try and use it as a RandomAccessFile or SequentialFile I get output
of question marks (ie: ??????????????????).
<P>I would greatly appreciate any help you can offer. I know that
it is reading the file, but the am uncertain of why it is giving me that
characters it is. Do I need to convert them or something?
<BR> </HTML>
--------------072A26FE87CFEC73A0C932DF--
Technical Details
Message-ID:
<35DADFFF.C02DD5A8@ihsenergy.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,6ee12b7a77b25a71,start X-Google-Attributes: gidf74b3,public From: David Clark <dclark@h2net.net> Subject: file io Date: 1998/08/19 Message-ID: <35DADFFF.C02DD5A8@ihsenergy.com> X-Deja-AN: 382646980 Content-Type: multipart/alternative; boundary="------------072A26FE87CFEC73A0C932DF" Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language