@ Override public WsByteBuffer [ ] marshallBinaryFirstLine ( ) { WsByteBuffer [ ] firstLine = new WsByteBuffer [ 1 ] ; firstLine [ 0 ] = allocateBuffer ( getOutgoingBufferSize ( ) ) ; // prepend the binary protocol version first firstLine = putByte ( HttpInternalConstants . BINARY_TRANSPORT_V1 , firstLine ) ; if ( getVersionValue ( ) . isUndefined ( ) ) { // unknown version....marshall (masked(len)+Str) byte [ ] data = getVersionValue ( ) . getByteArray ( ) ; firstLine = putInt ( data . length | GenericConstants . KNOWN_MASK , firstLine ) ; firstLine = putBytes ( data , firstLine ) ; } else { // known version...marshall versionID firstLine = putInt ( getVersionValue ( ) . getOrdinal ( ) , firstLine ) ; } // Status Code firstLine = putInt ( this . myStatusCode . getIntCode ( ) , firstLine ) ; if ( null != this . myReasonBytes ) { // Reason exists....marshall (len+Str) firstLine = putInt ( this . myReasonBytes . length , firstLine ) ; firstLine = putBytes ( this . myReasonBytes , firstLine ) ; } else { // reason does not exist...marshall 0 as len firstLine = putInt ( 0 , firstLine ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Marshalling binary first line: " + getVersion ( ) + " " + getStatusCodeAsInt ( ) + " " + getReasonPhrase ( ) ) ; } // don't flip the last buffer as headers get tacked on the end return firstLine ; }
Called for marshalling the first line of binary HTTP responses .