public final class XdrOutputStream
extends java.io.BufferedOutputStream
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  XdrOutputStreamwith default buffer size. | 
| XdrOutputStream(java.io.OutputStream out,
               int bufferSize)Create a new instance of  XdrOutputStreamwith the specified buffer size. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Close this stream and the underlying output stream. | 
| void | enableCompression()Wraps the underlying stream for zlib compression. | 
| void | setCipher(javax.crypto.Cipher cipher)Wraps the underlying stream for encryption using the provided  cipher. | 
| void | write(byte[] b,
     int off,
     int len)Writes  lenbytes from the specified byte array
 starting at offsetoffto this output stream as defined byOutputStream.write(byte[], int, int). | 
| void | write(byte[] b,
     int offset,
     int len,
     int pad)Write a  bytebuffer to the underlying output stream
 in XDR format. | 
| void | writeAlignment(int length)Writes the  0x00alignment for the specified length. | 
| void | writeBuffer(byte[] buffer)Write a  bytebuffer to the underlying output stream in
 XDR format. | 
| void | writeDirect(byte[] data)Writes directly to the  OutputStreamof the underlying socket. | 
| void | writeInt(int v)Write an  intvalue to the underlying stream in XDR format. | 
| void | writeLong(long v)Write a  longvalue 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  Xdrableto 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 default buffer size.out - The underlying OutputStream to write topublic XdrOutputStream(java.io.OutputStream out,
               int bufferSize)
XdrOutputStream with the specified buffer size.out - The underlying OutputStream to write tobufferSize - The size of the bufferpublic 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(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.BufferedOutputStreamb - 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 close()
           throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterOutputStreamjava.io.IOException - if an error occurs while closing the
         underlying stream@InternalApi public void enableCompression() throws java.io.IOException
java.io.IOException - If the underlying stream is already set up for compressionpublic void setCipher(javax.crypto.Cipher cipher)
               throws java.io.IOException
cipher.
 
 An implementation wrapping a stream that also implements EncryptedStreamSupport may delegate this call to
 that wrapped stream.
 
cipher - Cipher for the streamjava.io.IOException - If the underlying stream is already wrappedpublic 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-2020 Jaybird (Firebird JDBC/JCA) team. All rights reserved.