|
||||||||||
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.NativeObject ca.idms.io.NativeBase
public class NativeBase
Base class for the implementations of Native objects. Provides additional methods to support reading and writing both converted and byte array formats.
Field Summary | |
---|---|
protected int |
options
Options that control how the object reads and writes native data. |
static int |
READ_BOTH
Read both bytes and objects from the input buffer. |
static int |
SET_LENGTH
Set len after writing. |
Fields inherited from class ca.idms.io.NativeObject |
---|
buffer, length, offset |
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 | |
---|---|
NativeBase()
Base constructor. |
|
NativeBase(int len)
Base constructor to read a byte array from a stream. |
Method Summary | |
---|---|
int |
getOptions()
|
int |
length(NativeFormat fmt,
int nat,
int utf,
int uni)
Computes the estimated size of the native form of the object. |
boolean |
readBuffer(NativeDataInputStream in)
Conditionally reads bytes from a stream. |
void |
setOptions(int i)
|
boolean |
writeBuffer(NativeDataOutputStream out)
Conditionally writes bytes to a stream. |
Methods inherited from class ca.idms.io.NativeObject |
---|
get, getBuffer, getClient, getOffset, length, length, readNative, snap, writeNative |
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, 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 READ_BOTH
public static final int SET_LENGTH
len
after writing.
The next read will then link to the byte array buffer
instead of converting it to objects.
protected int options
READ_BOTH
,
SET_LENGTH
Constructor Detail |
---|
public NativeBase()
public NativeBase(int len)
The readNative method gets the buffer and current offset from the TraceBufferInputStream contained in the input stream. When READ_BOTH is set the readNative method does not advance the current offset in the input stream, allowing the data to also be read as objects.
The writeNative method writes data directly from the input stream's byte array. If data has not been read yet it writes nulls for the absolute value of the length specified to allocate an output buffer.
len
- the length of the array.options
Method Detail |
---|
public int length(NativeFormat fmt, int nat, int utf, int uni)
fmt
- NativeFormat object or null.nat
- actual native length.utf
- estimated UTF-8 length.uni
- estimated Unicode length.
public int getOptions()
public void setOptions(int i)
i
- read write optionsREAD_BOTH
,
SET_LENGTH
public boolean readBuffer(NativeDataInputStream in) throws java.io.IOException
buf == null && len != 0
.
When len < 0
the input stream position remains unchanged,
allowing the data to be read into objects as well as a buffer.
This can be used to read data directly from a TraceBufferInputStream byte array into an output stream.
readBuffer
in class NativeObject
in
- the native buffered input stream
java.io.IOException
- if an IO error occursNativeBase(int)
,
NativeObject.readBuffer(ca.idms.io.NativeDataInputStream)
public boolean writeBuffer(NativeDataOutputStream out) throws java.io.IOException
buf == null && len != 0
.
This can be used to allocate space in a larger buffer contained in a TraceBufferOutputStream. No buffer remains allocated in this object.
writeBuffer
in class NativeObject
out
- the native buffered output stream.
java.io.IOException
- if an IO error occursNativeBase(int)
,
NativeObject.writeBuffer(ca.idms.io.NativeDataOutputStream)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |