Class WireOutput (0.14.1)

publicabstractclass WireOutput

Classes inheriting WireOutput concern themselves with sending data back to the client using PG wire protocol. These classes function similarly to com.google.cloud.spanner.pgadapter.wireprotocol.WireMessage in that they use the constructor to instantiate items, but require send to be called to actually send data. Here, you must override postSend with data you wish to send. Note that this subclass will handle sending the identifier and length (provided you initialize them correctly through getIdentifier and he constructor respectively) via send, so you just have to implement payload sending.

Inheritance

java.lang.Object > WireOutput

Static Fields

UTF8

protectedstaticfinalCharsetUTF8
Field Value
Type Description

Constructors

WireOutput(DataOutputStream output, int length)

publicWireOutput(DataOutputStreamoutput,intlength)
Parameters
Name Description
length int

Fields

length

protectedintlength
Field Value
Type Description
int

outputStream

protectedDataOutputStreamoutputStream
Field Value
Type Description

Methods

getIdentifier()

publicabstractbytegetIdentifier()

Override this to specify the byte which represents the protocol for the specific message. Used for logging and by send.

Returns
Type Description

getMessageName()

protectedabstractStringgetMessageName()

Used for logging.

Returns
Type Description
String

The official name of the wire message.

getPayloadString()

protectedabstractStringgetPayloadString()

Used for logging.

Returns
Type Description
String

Payload metadata.

isCompoundResponse()

protectedbooleanisCompoundResponse()

Whether this response sends more data than just the identifier (i.e.: length). WireOutput items are convoluted in that some do send a large payload, and other (such as DeclineSSLResponse) send only one byte back. Override with false if that is the case.

Returns
Type Description
boolean

True if compound, false otherwise.

send()

publicvoidsend()

This is the method which must be called to actually send data. Here we log information, send the protocol identifier and length automatically (provided those items were instantiated correctly). For most WireOutput subclasses this should be unchanged; there are however exceptions (such as where length) need not be sent for very specific protocols: for those, override this and you will need to send the identifier and log yourself.

Exceptions
Type Description

send(boolean flush)

publicvoidsend(booleanflush)

Same as #send(), but with the option to skip the flush at the end. This is more efficient for responses that contain multiple parts, such as query results.

Parameter
Name Description
flush boolean
Exceptions
Type Description

sendPayload()

protectedabstractvoidsendPayload()

Override this method to include post-processing and metadata in the sending process. Template method for send.

Exceptions
Type Description

toString()

publicStringtoString()
Returns
Type Description
Overrides

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.