@Override public void write(final OutputStream output) throws IOException { if (!isValid()) return; super.write(output); final int byteCount; if (getHeaderType() == QDefines.QBYTE_BUFFER_TYPE8) { QUtils.writeByte(value.length, output); byteCount = getInternalSize() - 1; } else { assert (getHeaderType() == QDefines.QBYTE_BUFFER_TYPE16); QUtils.writeWord(value.length, output); byteCount = getInternalSize() - 2; } output.write(value, 0, byteCount); }