🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #3399

Newbie Questions

#3399
From: David Gordon
Date: Mon, 26 Jan 1998 00:00
25 lines
1370 bytes
I am writing a program that reads a simple text file.   I have created a
loop that reads the file as a byte stream.  Shown below is a code fragment
from the program:

try {
          while (ZipCodeFile.read(StateAbbrv) != -1) {
              String s = new String(StateAbbrv,0);
              ZipCodeFile.read();
              ZipCodeFile.read(ZipCodeRangeLow);
              ZipStringLow = new String(ZipCodeRangeLow,0);
              Low = Low.decode(ZipStringLow);
              ZipCodeLow = Low.intValue() * 100;
...

I have a couple of questions.  First, can I keep allocating the String
variable s new each time?  If not what would be a recommended approach.
Second,  I use a String constructor to convert the byte array into a String.
Reading the help, it says this function does not work and will not be
supported in later releases.  Any suggestions on how I can recode this
expression?  Thank you.

David

dgordon@microdsi.com
Technical Details
Message-ID: <6aja34$rke6@forums.borland.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: 1089d0,3fd1b5931125b313,start
X-Google-Attributes: gid1089d0,public
From: "David Gordon" <dgordon@microdsi.net>
Subject: Newbie Questions
Date: 1998/01/26
Message-ID: <6aja34$rke6@forums.borland.com>
X-Deja-AN: 319516642
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: None
Newsgroups: borland.public.jbuilder.java.api