|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.idms.io.TraceObject ca.idms.io.NativeFormat
public class NativeFormat
Specifies native data formats.
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 |
---|
public static final int NATIVE
public static final int UTF8
public static final int UNICODE
public static final int EBCDIC
public static final int CECP
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.
public static final int FORMAT
public static final int X86
public static final int S390
public static final int IDMS
public static final int X64
public static final int PLATFORM
public static final int LOCAL
public static final int CLIENT
public static final int SERVER
public static final byte SO
public static final byte SI
public static final byte ZONE42
public static final int ROLE
public static final java.lang.String SPACES
public static final byte[] NULLS
protected boolean low
protected boolean ieee
protected java.lang.String enc
protected boolean katakana
protected java.lang.String enci
protected NativeCodePage cecp
protected int bytes
protected int format
protected int platform
protected int role
Constructor Detail |
---|
public NativeFormat()
public NativeFormat(java.lang.String enc)
enc
- character encoding to override the defaultNativeFormat(boolean, boolean, String, int)
public NativeFormat(java.lang.String enc, int opt)
enc
- character encodingopt
- format optionsNativeFormat(boolean, boolean, String, int)
public NativeFormat(int opt)
opt
- format optionsNativeFormat(boolean, boolean, String, int)
,
UTF8
,
UNICODE
,
EBCDIC
public NativeFormat(boolean low, boolean ieee, java.lang.String enc, int opt)
low
- low-endian numeric byte orderieee
- flt IEEE floating point formatenc
- character encodingopt
- conversion optionsMethod Detail |
---|
protected java.lang.Object get(java.lang.reflect.Field f) throws java.lang.IllegalAccessException
get
in class TraceObject
f
- a Field returned by Class.getDeclaredFields
java.lang.IllegalAccessException
- should not
really happen, but Field.get requires itTraceObject.snap
,
TraceObject.snap()
public static final int getArch()
isX64()
,
isX86()
,
isS390()
public static final boolean isPC()
public static final boolean isX64()
public static final boolean isX86()
public static final boolean isS390()
public static final boolean isMicrosoft()
public static final java.lang.String getDefaultEnc()
public boolean isLow()
public boolean isIEEE()
public java.lang.String getEnc()
public int getFormat()
format
,
NATIVE
,
UTF8
,
UNICODE
public boolean isNative()
getFormat()
,
isUTF8()
,
isUnicode()
public boolean isUTF8()
getFormat()
,
isNative()
,
isUnicode()
public boolean isUnicode()
getFormat()
,
isNative()
,
isUTF8()
public boolean isSOSI()
S390
,
getPlatform()
public boolean isKatakana()
public int getPlatform()
platform
,
X86
,
S390
public int getRole()
role
,
LOCAL
,
CLIENT
,
SERVER
public boolean isLocal()
getRole()
public boolean isClient()
getRole()
public boolean isServer()
getRole()
public static java.lang.String toUpperAscii(java.lang.String str)
str
- string to convert
public static void toUpperEbcdic(byte[] buf, int off, int len)
buf
- byte array to convert to stringoff
- offset into byte arraylen
- length to convert (doubled if Unicode)public int getMaxBytesPerChar()
public java.lang.String getString(byte[] buf) throws java.io.UnsupportedEncodingException
buf
- byte array to convert to string
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic java.lang.String getString(byte[] buf, int off, int len) throws java.io.UnsupportedEncodingException
buf
- byte array to convert to stringoff
- offset into byte arraylen
- length to convert (doubled if Unicode)
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic java.lang.String getStringInternal(byte[] buf, int off, int len) throws java.io.UnsupportedEncodingException
buf
- byte array to convert to stringoff
- offset into byte arraylen
- length to convert (doubled if Unicode)
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic java.lang.String readBytes(java.io.DataInput in, int len) throws java.io.UnsupportedEncodingException, java.io.IOException
in
- input streamlen
- number of bytes (chars if Unicode) to read from stream
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occurspublic byte[] getBytes(java.lang.String str) throws java.io.UnsupportedEncodingException
str
- String to convert
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic byte[] getBytes(java.lang.String str, int len) throws java.io.UnsupportedEncodingException, DataTruncationException
When the encoding is Unicode, the length is doubled.
str
- String to convertlen
- length of byte array, padded with spaces
DataTruncationException
- if the result is truncated
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic byte[] getBytesInternal(java.lang.String str, int len) throws java.io.UnsupportedEncodingException, DataTruncationException
str
- String to convertlen
- length of byte array, padded with spaces
DataTruncationException
- if the result is truncated
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic byte[] pad(byte[] b, int len) throws DataTruncationException, java.io.UnsupportedEncodingException
b
- array of bytes to padlen
- desired length of byte array
DataTruncationException
- if the result is truncated
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic void writeBytes(java.io.DataOutput out, java.lang.String str) throws java.io.IOException
out
- output streamstr
- String to convert
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occurspublic void writeBytes(java.io.DataOutput out, java.lang.String str, int len) throws java.io.IOException
out
- output streamstr
- String to convertlen
- length to send, padded with spaces
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occursgetBytes(String, int)
public java.lang.String readBytesZ(java.io.DataInput in, int len) throws java.io.IOException
in
- input streamlen
- maximum length to read from stream
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occurspublic byte[] getBytesZ(java.lang.String s) throws java.io.UnsupportedEncodingException
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.
s
- String to convert
java.io.UnsupportedEncodingException
- if the
character set encoding is not supportedpublic void writeBytesZ(java.io.DataOutput out, java.lang.String str) throws java.io.IOException
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
out
- output streamstr
- String to convert
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occurspublic NativeDataInputStream getDataInput(TraceBufferInputStream in)
in
- underlying input stream
FloDataInputStream
,
LoDataInputStream
public NativeDataOutputStream getDataOutput(TraceBufferOutputStream out)
out
- underlying DataOutputStream
FloDataOutputStream
,
LoDataOutputStream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |