🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18092

file io

#18092
From: David Clark
Date: Wed, 19 Aug 1998 00:00
57 lines
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.&nbsp; But when I try the following I get numbers
(ie:32 32 46... ):
<BR>&nbsp;
<BLOCKQUOTE>theFile = new File("C:/uwi.lst");
<BR>in = new FileInputStream(theFile);
<BR>ReportStuff - new StringBuffer();
<BR>&nbsp;int c;
<BR>&nbsp;while ((c = in.read()) != -1)
<BR>&nbsp;{
<BR>&nbsp;&nbsp; reportStuff.append(in.read());
<BR>&nbsp;}
<BR>&nbsp;&nbsp; System.out.println( reportStuff);
<BR>&nbsp;</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.&nbsp; I know that
it is reading the file, but the am uncertain of why it is giving me that
characters it is.&nbsp; Do I need to convert them or something?
<BR>&nbsp;</HTML>

--------------072A26FE87CFEC73A0C932DF--
Technical Details
Message-ID: <35DADFFF.C02DD5A8@ihsenergy.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show 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