Class WireOutput (0.14.1)
Stay organized with collections
Save and categorize content based on your preferences.
publicabstractclass WireOutputClasses 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.
Inherited Members
Static Fields
UTF8
protectedstaticfinalCharsetUTF8Constructors
WireOutput(DataOutputStream output, int length)
publicWireOutput(DataOutputStreamoutput,intlength)Fields
length
protectedintlengthoutputStream
protectedDataOutputStreamoutputStreamMethods
getIdentifier()
publicabstractbytegetIdentifier()Override this to specify the byte which represents the protocol for the specific message. Used for logging and by send.
getMessageName()
protectedabstractStringgetMessageName()Used for logging.
The official name of the wire message.
getPayloadString()
protectedabstractStringgetPayloadString()Used for logging.
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.
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.
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.
sendPayload()
protectedabstractvoidsendPayload()Override this method to include post-processing and metadata in the sending process. Template method for send.
toString()
publicStringtoString()