public final class XdrOutputStream
extends java.io.OutputStream
XdrOutputStream writes data in XDR format to an
underlying java.io.OutputStream.
This class is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static int |
NULL_BYTE |
static int |
SPACE_BYTE |
| Constructor and Description |
|---|
XdrOutputStream(java.io.OutputStream out)
Create a new instance of
XdrOutputStream with buffering. |
XdrOutputStream(java.io.OutputStream out,
boolean buffered)
Create a new instance of
XdrOutputStream with either a buffered or an unbuffered stream. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this stream and the underlying output stream.
|
void |
flush()
Flush all buffered data to the underlying output stream.
|
void |
setCipher(javax.crypto.Cipher cipher) |
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off to this output stream as defined by OutputStream.write(byte[], int, int). |
void |
write(byte[] b,
int offset,
int len,
int pad)
Write a
byte buffer to the underlying output stream
in XDR format. |
void |
write(int b)
Write a single
byte to the underlying output stream in
XDR format. |
void |
writeAlignment(int length)
Writes the
0x00 alignment for the specified length. |
void |
writeBuffer(byte[] buffer)
Write a
byte buffer to the underlying output stream in
XDR format. |
void |
writeDirect(byte[] data)
Writes directly to the
OutputStream of the underlying socket. |
void |
writeInt(int v)
Write an
int value to the underlying stream in XDR format. |
void |
writeLong(long v)
Write a
long value to the underlying stream in XDR format. |
void |
writePadding(int length,
int padByte)
Writes padding for the specified length of the specified padding byte.
|
void |
writeSpacePadding(int length)
Writes space (
0x20) padding of the specified length |
void |
writeString(java.lang.String s,
Encoding encoding)
Write content of the specified string using the specified encoding.
|
void |
writeTyped(int type,
Xdrable item)
Write an
Xdrable to this output stream. |
void |
writeTyped(ParameterBuffer parameterBuffer) |
void |
writeZeroPadding(int length)
Writes zero padding of the specified length
|
public static final int SPACE_BYTE
public static final int NULL_BYTE
public XdrOutputStream(java.io.OutputStream out)
XdrOutputStream with buffering.out - The underlying OutputStream to write topublic XdrOutputStream(java.io.OutputStream out,
boolean buffered)
XdrOutputStream with either a buffered or an unbuffered stream.out - The underlying OutputStream to write tobuffered - true Uses buffering (like XdrOutputStream(java.io.OutputStream) or
false writes directly to provided OutputStream.public void writeAlignment(int length)
throws java.io.IOException
0x00 alignment for the specified length. This padding is calculated as
(4 - length) & 3.length - The length of the previously written buffer to padjava.io.IOException - if an error occurs while writing to the
underlying output streampublic void writeZeroPadding(int length)
throws java.io.IOException
length - Length to writejava.io.IOException - if an error occurs while writing to the underlying output streamwritePadding(int, int)public void writeSpacePadding(int length)
throws java.io.IOException
0x20) padding of the specified lengthlength - Length to writejava.io.IOException - if an error occurs while writing to the underlying output streamwritePadding(int, int)public void writePadding(int length,
int padByte)
throws java.io.IOException
Prefer using the more specific writeZeroPadding(int) and writeZeroPadding(int).
length - Length of padding to writepadByte - Padding byte to usejava.io.IOException - if an error occurs while writing to the underlying output streamwriteSpacePadding(int),
writeZeroPadding(int)public void writeBuffer(byte[] buffer)
throws java.io.IOException
byte buffer to the underlying output stream in
XDR format.buffer - The byte buffer to be writtenjava.io.IOException - if an error occurs while writing to the
underlying output streampublic void writeString(java.lang.String s,
Encoding encoding)
throws java.io.IOException
java.io.IOExceptionpublic void writeTyped(int type,
Xdrable item)
throws java.io.IOException
Xdrable to this output stream.type - Type of the Xdrable to be written,
e.g. ISCConstants.isc_tpb_version3item - The object to be writtenjava.io.IOException - if an error occurs while writing to the
underlying output streampublic void writeTyped(ParameterBuffer parameterBuffer) throws java.io.IOException
java.io.IOExceptionpublic void writeLong(long v)
throws java.io.IOException
long value to the underlying stream in XDR format.v - The long value to be writtenjava.io.IOException - if an error occurs while writing to the
underlying output streampublic void writeInt(int v)
throws java.io.IOException
int value to the underlying stream in XDR format.v - The int value to be writtenjava.io.IOException - if an error occurs while writing to the
underlying output streampublic void write(byte[] b,
int offset,
int len,
int pad)
throws java.io.IOException
byte buffer to the underlying output stream
in XDR format.b - The byte buffer to be writtenoffset - The start offset in the bufferlen - The number of bytes to writepad - The number of (blank) padding bytes to writejava.io.IOException - if an error occurs while writing to the
underlying output streampublic void write(int b)
throws java.io.IOException
byte to the underlying output stream in
XDR format.write in class java.io.OutputStreamb - The value to be written, will be truncated to a bytejava.io.IOException - if an error occurs while writing to the
underlying output streampublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
len bytes from the specified byte array
starting at offset off to this output stream as defined by OutputStream.write(byte[], int, int).
Important: do not confuse this method with write(byte[], int, int, int) which originally had
the signature of this method.
write in class java.io.OutputStreamb - The dataoff - The start offset in the datalen - The number of bytes to writejava.io.IOException - if an error occurs while writing to the
underlying output streampublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException - if an error occurs while writing to the
underlying output streampublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOException - if an error occurs while closing the
underlying streampublic void setCipher(javax.crypto.Cipher cipher)
throws java.io.IOException
java.io.IOExceptionpublic final void writeDirect(byte[] data)
throws java.io.IOException
OutputStream of the underlying socket.data - Data to writejava.io.IOException - For errors writing to the socket.Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.