|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream java.io.FilterOutputStream ca.idms.io.NativeDataOutputStream
public class NativeDataOutputStream
A NativeDataOutputStream writes "native" data to a buffered output stream.
This class combines a DataOutputStream, a NativeFormat, and a
TraceBufferOutputStream, and provides additional features to those
defined by the DataOutput interface:
final
, so this
class can be a base class for specialized data output classes.
TraceBufferOutputStream
,
NativeFormat
,
LoDataInputStream
,
FloDataInputStream
,
UtfDataInputStream
,
UnicodeDataInputStream
Field Summary | |
---|---|
protected java.io.DataOutputStream |
dos
Contains the default methods. |
protected NativeFormat |
fmt
Describes the native data formats. |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Method Summary | |
---|---|
byte[] |
getBuffer()
Gets the buffer. |
int |
getCount()
Gets the number of valid bytes in the buffer. |
NativeFormat |
getFormat()
|
void |
setBuffer(byte[] buf,
int len)
Sets the buffer. |
void |
setCount(int len)
Set the number of valid bytes in the buffer. |
void |
setSize(int len)
Sets the size of the buffer. |
void |
snap(boolean f)
Displays the contents of this buffer if tracing is enabled. |
protected char[] |
toCharArray(java.math.BigDecimal big,
int prec,
int scale)
Converts a BigDecimal object to a "numeric" string. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to the underlying output stream. |
void |
writeBoolean(boolean b)
Writes a boolean to the data output stream. |
void |
writeByte(int v)
Writes a byte to the data output stream. |
void |
writeBytes(java.lang.String str)
Writes a string to a stream as an array of bytes. |
void |
writeBytes(java.lang.String str,
int len)
Writes a string to a stream as fixed length an array of bytes. |
void |
writeBytesInternal(java.lang.String str,
int len)
Writes an internal control block string to a stream as fixed length an array of bytes. |
void |
writeBytesVariable(java.lang.String str,
int len)
Writes an variable length string (VARCHAR) to a stream. |
void |
writeChar(int v)
Writes a char to the data output stream. |
void |
writeChars(java.lang.String s)
Writes a string to the data output stream as a sequence of Unicode characters. |
void |
writeDouble(double v)
Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the underlying output stream as an 8-byte quantity, low byte first. |
void |
writeFloat(float v)
Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream as a 4-byte quantity, low byte first. |
void |
writeGraphic(java.lang.String s,
int len)
Writes a String as OS/390 DBCS data. |
void |
writeInt(int v)
Writes an int to the data output stream. |
void |
writeLong(long v)
Writes a long to the data output stream. |
void |
writeNulls(int len)
Writes null bytes to a stream as filler. |
void |
writePacked(java.math.BigDecimal big,
int prec,
int scale,
boolean signed)
Writes a BigDecimal in "PACKED DECIMAL" format. |
void |
writeShort(int v)
Writes a short to the data output stream. |
void |
writeUTF(java.lang.String s)
Writes a string to the data output stream using UTF-8. |
void |
writeZoned(java.math.BigDecimal big,
int prec,
int scale,
boolean signed)
Write a BigDecimal in "ZONED DECIMAL" format. |
Methods inherited from class java.io.FilterOutputStream |
---|
close, flush, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.DataOutput |
---|
write, write |
Field Detail |
---|
protected java.io.DataOutputStream dos
protected NativeFormat fmt
Method Detail |
---|
public void setSize(int len)
len
- new buffer size.TraceBufferOutputStream.setSize(int)
public NativeFormat getFormat()
public byte[] getBuffer()
TraceBufferOutputStream.getBuffer()
public void setBuffer(byte[] buf, int len)
buf
- the new buffer contentslen
- the length of the arrayTraceBufferOutputStream.setBuffer(byte[], int)
public int getCount()
TraceBufferOutputStream.getCount()
public void setCount(int len)
len
- new count, ignored if out of rangeTraceBufferOutputStream.setCount(int)
public void snap(boolean f)
TraceBufferOutputStream.snap(boolean)
public void write(byte[] b, int off, int len) throws java.io.IOException
len
bytes from the specified byte array
starting at offset off
to the underlying output stream.
write
in interface java.io.DataOutput
write
in class java.io.FilterOutputStream
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.
java.io.IOException
- if an I/O error occurs.public void writeBoolean(boolean b) throws java.io.IOException
writeBoolean
in interface java.io.DataOutput
b
- a boolean value to be written.
java.io.IOException
public void writeByte(int v) throws java.io.IOException
writeByte
in interface java.io.DataOutput
v
- a byte value to be written.
java.io.IOException
- if an I/O error occurs.public void writeShort(int v) throws java.io.IOException
writeShort
in interface java.io.DataOutput
v
- a short to be written.
java.io.IOException
- if an I/O error occurs.public void writeChar(int v) throws java.io.IOException
writeChar
in interface java.io.DataOutput
v
- a char value to be written.
java.io.IOException
- if an I/O error occurs.public void writeInt(int v) throws java.io.IOException
writeInt
in interface java.io.DataOutput
v
- an int to be written.
java.io.IOException
- if an I/O error occurs.public void writeLong(long v) throws java.io.IOException
writeLong
in interface java.io.DataOutput
v
- a long to be written.
java.io.IOException
- if an I/O error occurs.public void writeFloat(float v) throws java.io.IOException
writeFloat
in interface java.io.DataOutput
v
- a float value to be written.
java.io.IOException
- if an I/O error occurs.Float.floatToIntBits(float)
public void writeDouble(double v) throws java.io.IOException
writeDouble
in interface java.io.DataOutput
v
- a double value to be written.
java.io.IOException
- if an I/O error occurs.Double.doubleToLongBits(double)
public void writeBytes(java.lang.String str) throws java.io.IOException
writeBytes
in interface java.io.DataOutput
str
- String to convert
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occurspublic void writeChars(java.lang.String s) throws java.io.IOException
writeChars
in interface java.io.DataOutput
s
- a String value to be written.
java.io.IOException
- if an I/O error occurs.public void writeUTF(java.lang.String s) throws java.io.IOException
writeUTF
in interface java.io.DataOutput
s
- a String to be written.
java.io.IOException
- if an I/O error occurs.public void writeBytes(java.lang.String str, int len) throws java.io.IOException, java.io.UnsupportedEncodingException, DataTruncationException
str
- String to convertlen
- the length of the output in bytes
DataTruncationException
- if the result is truncated
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occursNativeDataInputStream.readBytes(int)
public void writeBytesInternal(java.lang.String str, int len) throws java.io.IOException, java.io.UnsupportedEncodingException, DataTruncationException
str
- String to convertlen
- the length of the output in bytes
DataTruncationException
- if the result is truncated
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occursNativeDataInputStream.readBytesInternal(int)
public void writeBytesVariable(java.lang.String str, int len) throws java.io.IOException, java.io.UnsupportedEncodingException, DataTruncationException
str
- String to convertlen
- the length of the output in bytes
DataTruncationException
- if the result is truncated
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occursNativeDataInputStream.readBytesInternal(int)
public void writeNulls(int len) throws java.io.IOException
len
- number of bytes to send
java.io.IOException
- if an IO error occurspublic void writePacked(java.math.BigDecimal big, int prec, int scale, boolean signed) throws DataTruncationException, java.io.IOException
big
- a BigDecimal value.prec
- total number of digitsscale
- number of digits after the decimalsigned
- true if type is signed
DataTruncationException
- if scale or precision exceeded
java.io.IOException
- if an IO error occurstoCharArray(java.math.BigDecimal, int, int)
public void writeZoned(java.math.BigDecimal big, int prec, int scale, boolean signed) throws DataTruncationException, java.io.IOException
Since zoned decimal is essentially a character format, the actual binary value written to the output stream depends on the encoding (but will be either ASCII or EBCDIC). Note that encoding the sign in the low order digit may make it a non numeric character.
The absolute value will be set if the type is UNSIGNED NUMERIC.
big
- a BigDecimal value.prec
- total number of digitsscale
- number of digits after the decimalsigned
- true if type is signed
java.io.UnsupportedEncodingException
- not likely
DataTruncationException
- if scale or precision exceeded
java.io.IOException
- if an IO error occursprotected char[] toCharArray(java.math.BigDecimal big, int prec, int scale) throws DataTruncationException
big
- a BigDecimal object.prec
- total number of digitsscale
- number of digits after the decimal
DataTruncationException
- if scale or precision exceededwritePacked(java.math.BigDecimal, int, int, boolean)
,
writeZoned(java.math.BigDecimal, int, int, boolean)
public void writeGraphic(java.lang.String s, int len) throws DataTruncationException, java.io.IOException
The CharToByte converter classes for DBCS_EBCDIC convert a String to mixed SBCS and DBCS characters.
OS/390 databases support two types of DBCS data. The CHAR and
VARCHAR types can contain mixed data, that is, SBCS EBCDIC with
embedded
s
- a Stringlen
- number of characters defined for GRAPHIC column
DataTruncationException
- if it won't fit
java.io.IOException
- if an IO error occurswriteBytes(java.lang.String)
,
UtfDataOutputStream.writeBytes(java.lang.String)
,
UnicodeDataOutputStream.writeBytes(java.lang.String)
,
NativeFormat.getBytes(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |