ca.idms.io
Class NativeFormat

java.lang.Object
  extended by ca.idms.io.TraceObject
      extended by ca.idms.io.NativeFormat
All Implemented Interfaces:
Trace
Direct Known Subclasses:
UnicodeFormat, UtfFormat

public class NativeFormat
extends TraceObject

Specifies native data formats.

Since:
CA IDMS Server 4.2
Version:
2.10 01/31/99
Author:
Dave Ross
See Also:
UtfFormat, UnicodeFormat, NativeDataInputStream, NativeDataOutputStream

Field Summary
protected  int bytes
          Maximum bytes per character in native format.
protected  NativeCodePage cecp
          Internal code page converter, if available.
static int CECP
          Format is CECP.
static int CLIENT
          Role is remote client.
static int EBCDIC
          Format is EBCDIC.
protected  java.lang.String enc
          Character set encoding.
protected  java.lang.String enci
          Character set encoding for internal data.
protected  int format
          Format: NATIVE (the default), UTF8, UNICODE, or CECP.
static int FORMAT
          Format option mask.
static int IDMS
          Native platform is IDMS.
protected  boolean ieee
          Floating point format.
protected  boolean katakana
          Character set encoding includes single byte Katakana.
static int LOCAL
          Role is local client.
protected  boolean low
          Numeric byte order.
static int NATIVE
          Format is compatible with native methods.
static byte[] NULLS
          80 nulls, to pad binary data.
protected  int platform
          Native platform: X86, S390, IDMS, or 0 (other).
static int PLATFORM
          Native platform option mask.
protected  int role
          Role: LOCAL (the default), CLIENT, or SERVER.
static int ROLE
          Role option mask.
static int S390
          Native platform is IBM System/390 (OMVS).
static int SERVER
          Role is proxy server.
static byte SI
          Mainframe DBCS Shift In character.
static byte SO
          Mainframe DBCS Shift Out character.
static java.lang.String SPACES
          80 spaces, to pad converted character data.
static int UNICODE
          Format is network using UNICODE.
static int UTF8
          Format is network using UTF-8.
static int X64
          Native platform is Intel X86-64, AMD64 or Itanium.
static int X86
          Native platform is Intel X86 compatible (Windows).
static byte ZONE42
          Mainframe DBCS double byte EBCDIC zone character.
 
Fields inherited from class ca.idms.io.TraceObject
exclude, EXCLUDE, FALSE, include, INCLUDE, logWriter, PREFIX, PROPERTIES_FILE, PROPERTIES_KEY, snap, SNAP, SNAP_BYTES, SNAP_NATIVE, SNAP_OBJECT, SNAP_SQL, snapBytes, snapNative, snapObject, snapSql, stub, trace, TRACE, TRACE_FILE, TRACE_LIFE, TRACE_NATIVE, TRACE_PRODUCT, traceLife, traceNative, traceStream, TRUE
 
Constructor Summary
NativeFormat()
          Sets local native data format attributes to local platform defaults.
NativeFormat(boolean low, boolean ieee, java.lang.String enc, int opt)
          Sets data conversion attributes to specified values.
NativeFormat(int opt)
          Sets network data format attributes to network format.
NativeFormat(java.lang.String enc)
          Sets local native data format attributes.
NativeFormat(java.lang.String enc, int opt)
          Sets network data format attributes to native format.
 
Method Summary
protected  java.lang.Object get(java.lang.reflect.Field f)
          Overrides the default get method to allow the default snap method access to the value of a non-public variable.
static int getArch()
          Gets local platform hardware architecture.
 byte[] getBytes(java.lang.String str)
          Converts a string into an array of bytes.
 byte[] getBytes(java.lang.String str, int len)
          Converts a string into a fixed length array of bytes.
 byte[] getBytesInternal(java.lang.String str, int len)
          Converts a string into a fixed length array of bytes according to this objects internal control block encoding.
 byte[] getBytesZ(java.lang.String s)
          Converts a string into a null terminated array of bytes.
 NativeDataInputStream getDataInput(TraceBufferInputStream in)
          Creates an input filter stream that reads numeric data as specified for this NativeFormat.
 NativeDataOutputStream getDataOutput(TraceBufferOutputStream out)
          Creates an output filter stream that writes numeric data as specified for this NativeFormat.
static java.lang.String getDefaultEnc()
          Gets local platform encoding.
 java.lang.String getEnc()
          Gets character encoding format.
 int getFormat()
          Gets the format.
 int getMaxBytesPerChar()
          Returns the maximum number of bytes needed to convert a char.
 int getPlatform()
          Gets native platform.
 int getRole()
          Gets client/server role.
 java.lang.String getString(byte[] buf)
          Converts an array of bytes into a string according to this object's character encoding.
 java.lang.String getString(byte[] buf, int off, int len)
          Converts an array of bytes into a string according to this object's character encoding.
 java.lang.String getStringInternal(byte[] buf, int off, int len)
          Converts an array of bytes into a string according to this object's internal control block character encoding.
 boolean isClient()
          Gets role, convenience method.
 boolean isIEEE()
          Gets floating point format.
 boolean isKatakana()
          Gets Katakana option in effect.
 boolean isLocal()
          Gets role, convenience method.
 boolean isLow()
          Gets integer format.
static boolean isMicrosoft()
          Gets local platform vendor.
 boolean isNative()
          Gets format, convenience method.
static boolean isPC()
          Gets local platform, convenience routine.
static boolean isS390()
          Gets local platform, convenience routine.
 boolean isServer()
          Gets role, convenience method.
 boolean isSOSI()
          A convenience method to check if the native character encoding is EBCDIC and uses SOSI for DBCS.
 boolean isUnicode()
          Gets format, convenience method.
 boolean isUTF8()
          Gets format, convenience method.
static boolean isX64()
          Gets local platform, convenience routine.
static boolean isX86()
          Gets local platform, convenience routine.
 byte[] pad(byte[] b, int len)
          Pads an array of bytes with spaces.
 java.lang.String readBytes(java.io.DataInput in, int len)
          Deprecated. use NativeDataInputStream.readBytes instead
 java.lang.String readBytesZ(java.io.DataInput in, int len)
          Reads a null terminated string from a stream as an array of bytes.
static java.lang.String toUpperAscii(java.lang.String str)
          Converts an array of bytes representing ASCII (or ANSI) characters to upper case.
static void toUpperEbcdic(byte[] buf, int off, int len)
          Converts an array of bytes representing EBCDIC characters to upper case.
 void writeBytes(java.io.DataOutput out, java.lang.String str)
          Deprecated. use NativeDataOutputStream.writeBytes instead
 void writeBytes(java.io.DataOutput out, java.lang.String str, int len)
          Deprecated. use NativeDataOutputStream.writeBytes instead
 void writeBytesZ(java.io.DataOutput out, java.lang.String str)
          Writes a string to a stream as a null terminated array of bytes.
 
Methods inherited from class ca.idms.io.TraceObject
finalize, getBoolean, getClasses, getInteger, getProperty, listProperties, message, parseList, print, print, print, println, println, snap, snap, snap, snap, snap, snap, snap, toHex, toHex, toHex, toHex, toHex, toString, trace, trace, trace, trace, trace, trace, traceEntry, unloadProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NATIVE

public static final int NATIVE
Format is compatible with native methods.

See Also:
Constant Field Values

UTF8

public static final int UTF8
Format is network using UTF-8. Indicates that the data format is platform independent, is sent over a network, and not compatible with native methods. Implies that low = false, ieee = true, and enc = "UTF8".

See Also:
Constant Field Values

UNICODE

public static final int UNICODE
Format is network using UNICODE. Indicates that the data format is platform independent, is sent over a network, and not compatible with native methods. Implies that low = false, iee = true, and enc = "Unicode".

See Also:
Constant Field Values

EBCDIC

public static final int EBCDIC
Format is EBCDIC. Indicates that the data format is EBCDIC, is platform dependent sent over a network, and compatible with native methods on the MF. Implies that low = false, ieee = false, and enc = "Cp037". This is meant for use by native code mainframe clients and servers.

See Also:
Constant Field Values

CECP

public static final int CECP
Format is CECP. Indicates that the internal NativeCodePage converter class is to be used instead of the built in Java converter classes. The internal converter class uses the Country Extended Code Page tables created by the native Code Page Editor on Windows, and loads them using the CLASSPATH. When this value is specified in the constructor, getFormat() returns NATIVE and isNative() returns true.

See Also:
Constant Field Values

FORMAT

public static final int FORMAT
Format option mask.

See Also:
Constant Field Values

X86

public static final int X86
Native platform is Intel X86 compatible (Windows). Indicates that the native methods run on an Intel x86 machine, usually Windows. This implies that low = true and ieee = true;

See Also:
Constant Field Values

S390

public static final int S390
Native platform is IBM System/390 (OMVS). Indicates that the native methods run on an IBM mainframe system, usually in the Unix System Services (USS) environment. This implies that low = false and ieee = false, and the character encoding is some variant of EBCDIC, with DBCS data delimited by SOSI (Shift-Out/Shift-In characters).

See Also:
Constant Field Values

IDMS

public static final int IDMS
Native platform is IDMS. Indicates that the native methods run on an IBM mainframe system inside the CA IDMS/DC or mini-CV enviroment. This implies that low = false and ieee = false, and the character encoding is some variant of EBCDIC, with DBCS data delimited by SOSI (Shift-Out/Shift-In characters). Note that this is set by native mainframe clients and servers, and never by a Java client or proxy server.

See Also:
Constant Field Values

X64

public static final int X64
Native platform is Intel X86-64, AMD64 or Itanium. Indicates that the native methods run in 64-bit mode, usually with Windows, on a machine with Intel x86-64 AMD64 or Itanium processor(s). Note that this value does not apply when running native methods in 32-bit mode on a 64-bit OS. This implies that low = true and ieee = true;

See Also:
Constant Field Values

PLATFORM

public static final int PLATFORM
Native platform option mask.

See Also:
Constant Field Values

LOCAL

public static final int LOCAL
Role is local client. Indicates that this object is used to exchange data directly with the local native method interface. This implies that format = NATIVE.

See Also:
Constant Field Values

CLIENT

public static final int CLIENT
Role is remote client. Indicates that this object is used by a remote client to exchange data with a proxy server over a network connection.

See Also:
Constant Field Values

SERVER

public static final int SERVER
Role is proxy server. Indicates that this object is used by a proxy server to exchange data with a remote client over a network connection.

See Also:
Constant Field Values

SO

public static final byte SO
Mainframe DBCS Shift Out character. Default is IBM.


SI

public static final byte SI
Mainframe DBCS Shift In character. Default is IBM.


ZONE42

public static final byte ZONE42
Mainframe DBCS double byte EBCDIC zone character. Default is IBM.


ROLE

public static final int ROLE
Role option mask.

See Also:
Constant Field Values

SPACES

public static final java.lang.String SPACES
80 spaces, to pad converted character data.

See Also:
Constant Field Values

NULLS

public static final byte[] NULLS
80 nulls, to pad binary data.


low

protected boolean low
Numeric byte order. Includes integers and floats


ieee

protected boolean ieee
Floating point format.


enc

protected java.lang.String enc
Character set encoding.


katakana

protected boolean katakana
Character set encoding includes single byte Katakana. Lower case characters are not supported by DBCS on the mainframe when this is true.


enci

protected java.lang.String enci
Character set encoding for internal data. Used to convert eyecatchers and other fields in internal control blocks that are limited to simple ASCII-EBCDIC conversion (no DBCS).


cecp

protected NativeCodePage cecp
Internal code page converter, if available.


bytes

protected int bytes
Maximum bytes per character in native format.


format

protected int format
Format: NATIVE (the default), UTF8, UNICODE, or CECP. This indicates whether data formatted using this object is compatible with native methods (wherever they run) or is a platform independent format used to transmit data over a network using either UTF-8 or Unicode.


platform

protected int platform
Native platform: X86, S390, IDMS, or 0 (other). This indicates the native method platform type. It is not necessarily the same as the local platform.


role

protected int role
Role: LOCAL (the default), CLIENT, or SERVER. This allows allow routines that read and write native data to be optimized separately for the client and server. This class can be extended to allow changing the flag during execution for loop back testing of native data routines.

Constructor Detail

NativeFormat

public NativeFormat()
Sets local native data format attributes to local platform defaults. This constructor is used with local native methods. All data is converted to the local platform default format, including character data.


NativeFormat

public NativeFormat(java.lang.String enc)
Sets local native data format attributes. This constructor is used with local native methods when it is necessary to override the default platform encoding. This is equivalent to using the 0-argument constructor and specifying the "file.encoding" property in the caidms.properties file

Parameters:
enc - character encoding to override the default
See Also:
NativeFormat(boolean, boolean, String, int)

NativeFormat

public NativeFormat(java.lang.String enc,
                    int opt)
Sets network data format attributes to native format. This constructor meant for use by a server to specify the native data formats that it requests from the client. The formats correspond to those used to call native methods.

Parameters:
enc - character encoding
opt - format options
See Also:
NativeFormat(boolean, boolean, String, int)

NativeFormat

public NativeFormat(int opt)
Sets network data format attributes to network format. This constructor is used by clients and servers when the native character encoding is not supported by the client and data must be exchanged between a client and server in network format:
integer
Big-endian
float
IEEE (unless format = EBCDIC)
character
UTF-8 or Unicode, specified in options

Parameters:
opt - format options
See Also:
NativeFormat(boolean, boolean, String, int), UTF8, UNICODE, EBCDIC

NativeFormat

public NativeFormat(boolean low,
                    boolean ieee,
                    java.lang.String enc,
                    int opt)
Sets data conversion attributes to specified values. Allows complete specification of the data formats:
low
When false all numeric data is read and written most significant byte first, as used internally in Java, on System/390, and most non Intel machines. When true numeric data is formatted low order byte first, as used on Intel processors. Note that this includes floating point data (Intel processors use a reverse order form of IEEE).
ieee
When true floating point data is read and written in IEEE format (reversed if low is true). When false IBM System/390 floating point format is use.
enc
Specifies the character set encoding used to convert character data to and from Unicode when type is NATIVE. When null the default platform encoding will be used. To use a network independent format, use the UTF8 or UNICODE format option (see below) instead of specifying \"UTF8\" or \"Unicode\".
opt
A bitmask used to specify additional options:
NATIVE
format: native method compatible.
UTF8
format: network using UTF-8.
UNICODE
format: network using Unicode.
EBCDIC
format: native using EBCDIC converter class.
CECP
format: native using internal converter class.
S390
platform: server is System/390 (USS)
X86
platform: server is Intel X86 (Windows)
IDMS
platform: server is IDMS-DC)
LOCAL
role: native client is local.
CLIENT
role: client side of network connection.
SERVER
role: proxy server side of network connection.
The caller is responsible for ensuring the option consistency.

Parameters:
low - low-endian numeric byte order
ieee - flt IEEE floating point format
enc - character encoding
opt - conversion options
Method Detail

get

protected java.lang.Object get(java.lang.reflect.Field f)
                        throws java.lang.IllegalAccessException
Overrides the default get method to allow the default snap method access to the value of a non-public variable.

Overrides:
get in class TraceObject
Parameters:
f - a Field returned by Class.getDeclaredFields
Returns:
the Object named by f
Throws:
java.lang.IllegalAccessException - should not really happen, but Field.get requires it
See Also:
TraceObject.snap, TraceObject.snap()

getArch

public static final int getArch()
Gets local platform hardware architecture.

Returns:
hardware architecture.
See Also:
isX64(), isX86(), isS390()

isPC

public static final boolean isPC()
Gets local platform, convenience routine.

Returns:
true if platform is Intel X86-compatible or 64-bit.

isX64

public static final boolean isX64()
Gets local platform, convenience routine.

Returns:
true if platform is x86-64, AMD64 or Itanium.

isX86

public static final boolean isX86()
Gets local platform, convenience routine.

Returns:
true if platform is Intel X86-compatible.

isS390

public static final boolean isS390()
Gets local platform, convenience routine.

Returns:
true if platform is System/390 compatible (OMVS).

isMicrosoft

public static final boolean isMicrosoft()
Gets local platform vendor.

Returns:
true if Java vendor is Microsoft.

getDefaultEnc

public static final java.lang.String getDefaultEnc()
Gets local platform encoding.

Returns:
default character encoding.

isLow

public boolean isLow()
Gets integer format.

Returns:
true if numbers are formatted low byte first.

isIEEE

public boolean isIEEE()
Gets floating point format.

Returns:
true if IEEE floating point, false if S390.

getEnc

public java.lang.String getEnc()
Gets character encoding format.

Returns:
character encoding or null to indicate the default.

getFormat

public int getFormat()
Gets the format.

Returns:
format flag.
See Also:
format, NATIVE, UTF8, UNICODE

isNative

public boolean isNative()
Gets format, convenience method.

Returns:
true if format is compatible with native methods.
See Also:
getFormat(), isUTF8(), isUnicode()

isUTF8

public boolean isUTF8()
Gets format, convenience method.

Returns:
true if format is "network" using UTF-8.
See Also:
getFormat(), isNative(), isUnicode()

isUnicode

public boolean isUnicode()
Gets format, convenience method.

Returns:
true if format is "network" using Unicode.
See Also:
getFormat(), isNative(), isUTF8()

isSOSI

public boolean isSOSI()
A convenience method to check if the native character encoding is EBCDIC and uses SOSI for DBCS.

Returns:
true if native platform is S390.
See Also:
S390, getPlatform()

isKatakana

public boolean isKatakana()
Gets Katakana option in effect.

Returns:
true if single byte Katakana is being used.

getPlatform

public int getPlatform()
Gets native platform. This returns the platform where the native methods run. This is not necessarily the same as the local platform unless isLocal is true.

Returns:
platform flag or 0
See Also:
platform, X86, S390

getRole

public int getRole()
Gets client/server role.

Returns:
role flag.
See Also:
role, LOCAL, CLIENT, SERVER

isLocal

public boolean isLocal()
Gets role, convenience method.

Returns:
true if native methods are local.
See Also:
getRole()

isClient

public boolean isClient()
Gets role, convenience method.

Returns:
true if role is remote client.
See Also:
getRole()

isServer

public boolean isServer()
Gets role, convenience method.

Returns:
true if role is proxy server.
See Also:
getRole()

toUpperAscii

public static java.lang.String toUpperAscii(java.lang.String str)
Converts an array of bytes representing ASCII (or ANSI) characters to upper case.

Parameters:
str - string to convert
Returns:
the original or converted string

toUpperEbcdic

public static void toUpperEbcdic(byte[] buf,
                                 int off,
                                 int len)
Converts an array of bytes representing EBCDIC characters to upper case.

Parameters:
buf - byte array to convert to string
off - offset into byte array
len - length to convert (doubled if Unicode)

getMaxBytesPerChar

public int getMaxBytesPerChar()
Returns the maximum number of bytes needed to convert a char.


getString

public java.lang.String getString(byte[] buf)
                           throws java.io.UnsupportedEncodingException
Converts an array of bytes into a string according to this object's character encoding.

Parameters:
buf - byte array to convert to string
Returns:
new String(byte[]) or new String(byte[], String)
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported

getString

public java.lang.String getString(byte[] buf,
                                  int off,
                                  int len)
                           throws java.io.UnsupportedEncodingException
Converts an array of bytes into a string according to this object's character encoding.

Parameters:
buf - byte array to convert to string
off - offset into byte array
len - length to convert (doubled if Unicode)
Returns:
new String(byte[]) or new String(byte[], String)
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported

getStringInternal

public java.lang.String getStringInternal(byte[] buf,
                                          int off,
                                          int len)
                                   throws java.io.UnsupportedEncodingException
Converts an array of bytes into a string according to this object's internal control block character encoding.

Parameters:
buf - byte array to convert to string
off - offset into byte array
len - length to convert (doubled if Unicode)
Returns:
new String(byte[]) or new String(byte[], String)
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported

readBytes

public java.lang.String readBytes(java.io.DataInput in,
                                  int len)
                           throws java.io.UnsupportedEncodingException,
                                  java.io.IOException
Deprecated. use NativeDataInputStream.readBytes instead

Reads a string from a stream as an array of bytes. An array of bytes is read from the input stream and converted to a String according to the encoding.

Parameters:
in - input stream
len - number of bytes (chars if Unicode) to read from stream
Returns:
a String
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported
java.io.IOException - if an IO error occurs

getBytes

public byte[] getBytes(java.lang.String str)
                throws java.io.UnsupportedEncodingException
Converts a string into an array of bytes. The String is converted an array of bytes according to the encoding in effect for this NativeFormat. If this encoding supports single byte Katakana it is converted to upper case first, since lower case characters are not valid.

Parameters:
str - String to convert
Returns:
String.getBytes() or String.getBytes(String)
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported

getBytes

public byte[] getBytes(java.lang.String str,
                       int len)
                throws java.io.UnsupportedEncodingException,
                       DataTruncationException
Converts a string into a fixed length array of bytes. This method is used to convert character data to a fixed length field that can be passed to a native method, either on the local platform or over a network connection. The string converted to a byte array according to the encoding and padded with converted spaces as needed.

When the encoding is Unicode, the length is doubled.

Parameters:
str - String to convert
len - length of byte array, padded with spaces
Returns:
the converted byte array
Throws:
DataTruncationException - if the result is truncated
java.io.UnsupportedEncodingException - if the character set encoding is not supported

getBytesInternal

public byte[] getBytesInternal(java.lang.String str,
                               int len)
                        throws java.io.UnsupportedEncodingException,
                               DataTruncationException
Converts a string into a fixed length array of bytes according to this objects internal control block encoding.

Parameters:
str - String to convert
len - length of byte array, padded with spaces
Returns:
the converted byte array
Throws:
DataTruncationException - if the result is truncated
java.io.UnsupportedEncodingException - if the character set encoding is not supported

pad

public byte[] pad(byte[] b,
                  int len)
           throws DataTruncationException,
                  java.io.UnsupportedEncodingException
Pads an array of bytes with spaces.

Parameters:
b - array of bytes to pad
len - desired length of byte array
Returns:
the padded byte array
Throws:
DataTruncationException - if the result is truncated
java.io.UnsupportedEncodingException - if the character set encoding is not supported

writeBytes

public void writeBytes(java.io.DataOutput out,
                       java.lang.String str)
                throws java.io.IOException
Deprecated. use NativeDataOutputStream.writeBytes instead

Writes a string to a stream as an array of bytes. The String is converted according to the encoding specified by this NativeFormat object and written to the output stream.

Parameters:
out - output stream
str - String to convert
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported
java.io.IOException - if an IO error occurs

writeBytes

public void writeBytes(java.io.DataOutput out,
                       java.lang.String str,
                       int len)
                throws java.io.IOException
Deprecated. use NativeDataOutputStream.writeBytes instead

Writes a string to a stream as an fixed length array of bytes. The string may be truncated or padded with spaces as needed, converted to a byte array according to the encoding in effect for this NativeObject, and written to the output stream.

Parameters:
out - output stream
str - String to convert
len - length to send, padded with spaces
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported
java.io.IOException - if an IO error occurs
See Also:
getBytes(String, int)

readBytesZ

public java.lang.String readBytesZ(java.io.DataInput in,
                                   int len)
                            throws java.io.IOException
Reads a null terminated string from a stream as an array of bytes. Bytes are read from the input stream until a null terminator is found or the maximum length is read, and converted to a String according to the encoding in effect for this NativeFormat. Using this method when the stream does not contain single byte characters can cause unpredictable results.

Parameters:
in - input stream
len - maximum length to read from stream
Returns:
String.getBytes() or String.getBytes(String)
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported
java.io.IOException - if an IO error occurs

getBytesZ

public byte[] getBytesZ(java.lang.String s)
                 throws java.io.UnsupportedEncodingException
Converts a string into a null terminated array of bytes.

The String is converted to a "C" string according to the encoding in effect for this NativeFormat. This should not be used when the encoding is Unicode or UTF8.

Parameters:
s - String to convert
Returns:
String.getBytes() or String.getBytes(String)
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported

writeBytesZ

public void writeBytesZ(java.io.DataOutput out,
                        java.lang.String str)
                 throws java.io.IOException
Writes a string to a stream as a null terminated array of bytes.

The String is converted to a "C" string according to the encoding in effect for this NativeFormat and written to the output stream. This should not be used when the encoding is Unicode or UTF8

Parameters:
out - output stream
str - String to convert
Throws:
java.io.UnsupportedEncodingException - if the character set encoding is not supported
java.io.IOException - if an IO error occurs

getDataInput

public NativeDataInputStream getDataInput(TraceBufferInputStream in)
Creates an input filter stream that reads numeric data as specified for this NativeFormat. The resulting stream will read numeric data in one of three ways:
Java
big-endian integers, IEEE floats
X86
little-endian integers, little-endian IEEE floats
S/390
big-endian integers, S/390 floats

Parameters:
in - underlying input stream
Returns:
a native data input stream
See Also:
FloDataInputStream, LoDataInputStream

getDataOutput

public NativeDataOutputStream getDataOutput(TraceBufferOutputStream out)
Creates an output filter stream that writes numeric data as specified for this NativeFormat. The resulting stream will write numeric data in one of three ways:
Java
big-endian integers, IEEE floats
X86
little-endian integers, little-endian IEEE floats
S/390
big-endian integers, S/390 floats

Parameters:
out - underlying DataOutputStream
Returns:
a stream that implements DataOutput
See Also:
FloDataOutputStream, LoDataOutputStream


Copyright © 2009 CA, All rights reserved