Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Localized streams

For JENV, as for OS/390, various new classes and methods have been implemented for localized streams, with the result that a number of ASCII/EBCDIC problems have been resolved. As an applications programmer, however, you are advised to restrict yourself to the InputStreamReader and OutputStreamWriter classes defined by Oracle America Inc. for inputting and outputting text.

The new classes implemented for this purpose are as follows

  • com.fujitsu.ts.java.io.LocalizedInputStream

  • com.fujitsu.ts.java.io.LocalizedOutputStream

  • com.fujitsu.ts.java.io.LocalizedPrintStream

These classes cannot be instantiated, but they do offer a static method localize(), which converts a specified stream into a “Localized Stream” if the specified stream is based on a file.

These methods are:

  • com.fujitsu.ts.java.io.LocalizedInputStream.localize(InputStream)

  • com.fujitsu.ts.java.io.LocalizedOutputStream.localize(OutputStream)

  • com.fujitsu.ts.java.io.LocalizedPrintStream.localize(OutputStream)

These methods now actually return an InputStream or OutputStream in BS2000 for which the behavior is modified in relation to the original stream in such a way that the entire I/O via this steam is subject to code set conversion from or into the implemented standard code set (value of system property file.encoding). However this only occurs for streams which are based on files. These methods have no effect on other streams (e.g. ByteArray).

These streams modified in this way thus behave in a similar way to the objects of the new classes InputStreamReader and OutputStreamWriter, but in contrast to them, remain of data type InputStream or OutputStream, and can thus be used wherever only objects of this type are permitted.

There are in-built precautionary features against double conversions. Thus, a stream cannot be “Localized” twice. If a getLocalized... method is called for a stream which has already been localized, that stream is simply returned. An instance of InputStreamReader or OutputStreamWriter can also be formed from a “Localized Stream” without any danger of this causing double conversions.

This JENV-specific extension can be deactivated by setting the system property java.localized.streams to the value False. This can be achieved if Java is called via -Djava.localized.streams=False.