Class WireOutput (0.27.1)
public abstract class 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.
Static Fields
UTF8
protected static final Charset UTF8
Field Value |
Type |
Description |
Charset |
|
Constructors
WireOutput(DataOutputStream output, int length)
public WireOutput(DataOutputStream output, int length)
Fields
length
Field Value |
Type |
Description |
int |
|
outputStream
protected DataOutputStream outputStream
Methods
getIdentifier()
public abstract byte getIdentifier()
Override this to specify the byte which represents the protocol for the specific message. Used
for logging and by send.
Returns |
Type |
Description |
byte |
|
getMessageName()
protected abstract String getMessageName()
Returns |
Type |
Description |
String |
The official name of the wire message.
|
getPayloadString()
protected abstract String getPayloadString()
Returns |
Type |
Description |
String |
Payload metadata.
|
isCompoundResponse()
protected boolean isCompoundResponse()
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()
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.
send(boolean flush)
public void send(boolean flush)
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
|
sendPayload()
protected abstract void sendPayload()
Override this method to include post-processing and metadata in the sending process. Template
method for send.
toString()
Returns |
Type |
Description |
String |
|
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-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-10 UTC."],[],[]]