× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi David,

Yep, sort of. In your case - cross platform - it's only because a
certain method in IFSTextFileInputStream does it for you.

Or doesn't do, in this case.

From the IFSTextFileInputStream javadoc I saw, which was for V5R1, the documentation for:

public java.lang.String read(int length)

is the only place I saw CCSID or conversion mentioned.

I wouldn't be surprised at all, in fact I would expect, that the
"properties" file doesn't load properly even using Java on the AS/400.
If it does, it's a convenience IBM decided to supply.

Using the IFSFileInputStream probably won't work running
on the 400 (without my modification) ... but I do know that using
a normal FileInputStream does work on the 400. I use it all the
time.


What I meant by the above was that I wouldn't expect a file using an
encoding other than (effectively) ISO 8859-1 to work on any system, given
the expectations documented in the Properties class.

From another mail:

Oddly enough, when Properties loads the InputStream ...
it creates a reader internally. You would think there
should be a way to load properties passing in a Reader
instead of an InputStream.

There is, as of Java 6.


Joe Sam

Joe Sam Shirah - http://www.conceptgo.com
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International? http://www.jguru.com/faq/I18N
Que Java400? http://www.jguru.com/faq/Java400

----- Original Message ----- From: "David Gibbs" <david@xxxxxxxxxxxx>
To: "Java Programming on and around the iSeries / AS400"
<java400-l@xxxxxxxxxxxx>
Sent: Monday, May 04, 2009 5:17 PM
Subject: Re: Brain cramp: reading an IFS file from program running on PC


Joe Sam Shirah wrote:
This is what I assumed the IFSTextFileInputStream class would do.
Reading
from a text file in Java should convert from >EBCDIC to Unicode
automatically.

Yep, sort of. In your case - cross platform - it's only because a
certain method in IFSTextFileInputStream does it for you.

Or doesn't do, in this case.

I'm 95% sure it DOES do that ... but I just can't figure out what I'm
doing wrong.

You're making some invalid assumptions.

True ... the assumption was that the code worked. The problem was that
there is clearly a bug in the IFSTextFileInputStream class.

After a bit of digging I was able to correct problem and will be
submitting a correction to the JT400 project.

I added the following method to IFSTextFileInputStream ...

----------
public int read(byte[] b) throws IOException {

String input = read(b.

byte[] inputBytes = input.getBytes();

int inputLength = input.length();

System.arraycopy(inputBytes, 0, b, 0, inputLength);

return inputLength;
}
----------

I wouldn't be surprised at all, in fact I would expect, that the
"properties" file doesn't load properly even using Java on the AS/400.
If
it does, it's a convenience IBM decided to supply.

Using the IFSFileInputStream probably won't work running on the 400
(without my modification) ... but I do know that using a normal
FileInputStream does work on the 400. I use it all the time.

david



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.