Article View: borland.public.jbuilder.java.api
Article #3522TextEdit example will not always display entire file.
From: Rich Downing
Date: Sat, 13 Dec 1997 00:00
Date: Sat, 13 Dec 1997 00:00
57 lines
2232 bytes
2232 bytes
While using the Borland TextEdit example I noticed that the program
would not always display the full contents of a text file.
For example, I have a text file of 73,728 bytes which will not display
at all. If I remove some of the data such that the file size becomes
53,248 bytes some of the file will display, and then some extraneous
characters will display (which display as square boxes), after which
the file display is truncated. if I reduce the file size still
further, the file will display correctly.
In the example, I created an intermediate string so that I could print
it to the Java console. It prints out fine. The problem seems to lie
with the textArea1.setText(s) command.
The same results occur using jre, jrew, java, javaw, and while running
in debug mode.
This occurs on Win 95 on a P100 with 64 meg, and also on Win 98 Beta 2
refresh on a P150 with 80 meg.
I could email the data file, or make it available on my ftp site if
anyone is interested.
The data in the character array and the string are ok. The code
snippet follows:
--------------
char[] data = new char[size];
while (in.ready())
{
chars_read += in.read(data, chars_read, size - chars_read);
}
in.close();
String s = new String(data, 0, chars_read);
System.out.print(s);
// textArea1.setText(new String(data, 0, chars_read));
textArea1.setText(s);
-----------------
Any ideas, guys????
Rich
----------------------------------------------------------------------
Richard V. Downing Work email: richard.downing@vsin.com
Senior Software Engineer Home email: rvd@mindspring.com
VideoConferencing Systems, Inc. Web: http://rvd.home.mindspring.com
Norcross, Ga
------------ When surrounded by wolves 'tis best to howl -------------
Technical Details
Message-ID:
<3492e23f.8340793@forums.borland.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: 1089d0,109b2266779bfe35,start X-Google-Attributes: gid1089d0,public From: rvd@mindspring.com (Rich Downing) Subject: TextEdit example will not always display entire file. Date: 1997/12/13 Message-ID: <3492e23f.8340793@forums.borland.com> X-Deja-AN: 297906121 Organization: None Newsgroups: borland.public.jbuilder.java.api