Get the number of bytes required to encode this set using
{@code MessageSet} wire format.
501857
public int getSerializedSizeAsMessageSet() {
    int result = 0;
    for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
      result += entry.getValue().getSerializedSizeAsMessageSetExtension(
        entry.getKey());
    }
    return result;
  }
758956
public static byte[] encodeLength(int length, int offset) {
        if (length < SIZE_THRESHOLD) {
            byte firstByte = (byte) (length + offset);
            return new byte[] { firstByte };
        } else if (length < MAX_ITEM_LENGTH) {
            byte[] binaryLength;
            if (length > 0xFF)
                binaryLength = intToBytesNoLeadZeroes(length);
            else
                binaryLength = new byte[] { (byte) length };
            byte firstByte = (byte) (binaryLength.length + offset + SIZE_THRESHOLD - 1);
            return concatenate(new byte[] { firstByte }, binaryLength);
        } else {
            throw new RuntimeException("Input too long");
        }
    }
886589
@Override
    public void readSet(int requestNumber, SIMessageHandle[] msgHandles) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "readSet",
                                           new Object[] { requestNumber, msgHandles });

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(this, tc, "Request to read " + msgHandles.length +
                                                     " message(s)");

        final ConversationState convState = (ConversationState) getConversation().getAttachment();

        try {
            SIBusMessage[] messages = bifSession.readSet(msgHandles);

            // Add the number of items first
            CommsServerByteBuffer buff = poolManager.allocate();
            buff.putInt(messages.length);

            for (int x = 0; x < messages.length; x++) {
                buff.putMessage((JsMessage) messages[x],
                                convState.getCommsConnection(),
                                getConversation());
            }

            try {
                getConversation().send(buff,
                                       JFapChannelConstants.SEG_READ_SET_R,
                                       requestNumber,
                                       JFapChannelConstants.PRIORITY_MEDIUM,
                                       true,
                                       ThrottlingPolicy.BLOCK_THREAD,
                                       null);
            } catch (SIException e) {
                FFDCFilter.processException(e,
                                            CLASS_NAME + ".readSet",
                                            CommsConstants.CATBIFCONSUMER_READSET_01,
                                            this);

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(this, tc, e.getMessage(), e);

                SibTr.error(tc, "COMMUNICATION_ERROR_SICO2033", e);
            }
        } catch (Exception e) {
            //No FFDC code needed
            //Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.
            if (!(e instanceof SIException) || !convState.hasMETerminated()) {
                FFDCFilter.processException(e,
                                            CLASS_NAME + ".readSet",
                                            CommsConstants.CATBIFCONSUMER_READSET_02,
                                            this);
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, e.getMessage(), e);

            StaticCATHelper.sendExceptionToClient(e,
                                                  CommsConstants.CATBIFCONSUMER_READSET_02,
                                                  getConversation(), requestNumber);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "readSet");
    }
1016428
static public int getByteSize() {
    int size = 0;
    size += 16;
    size += 16;
    size += 24;
    size += 24;
    size += 20;
    size += 3;
    size += 5;
    size += 36;
    size += 64;
    size += 64;
    size = size/8;
    return size;
  }
952462
public byte[] getBytes() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getBytes");

    byte[] b = null;
    try {
      b = string().getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
      FFDCFilter.processException(e, className + ".getBytes", "2", this);
    }

    byte[] c = new byte[b.length+1];

    c[0] = Cellule.LINKCELLULE;
    for (int i=0; i < b.length; i++) {
      c[i+1] = b[i];
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getBytes", c);
    return c;
  }
1107945
public byte[] getMessage() {
        byte result[] = new byte[events.length + 7];

        result[0] = (byte)(byteCount = events.length + 6);
        result[1] = (byte)(status >> 8);
        result[2] = (byte)(status & 0xFF);
        result[3] = (byte)(eventCount >> 8);
        result[4] = (byte)(eventCount & 0xFF);
        result[5] = (byte)(messageCount >> 8);
        result[6] = (byte)(messageCount & 0xFF);

        System.arraycopy(events, 0, result, 7, events.length);

        return result;
    }
835505
public byte[] encode() {
        byte[] bytes;
        switch (sizeOf(value)) {
            case 1:
                return new byte[]{(byte) value};
            case 3:
                bytes = new byte[3];
                bytes[0] = (byte) 253;
                Utils.uint16ToByteArrayLE((int) value, bytes, 1);
                return bytes;
            case 5:
                bytes = new byte[5];
                bytes[0] = (byte) 254;
                Utils.uint32ToByteArrayLE(value, bytes, 1);
                return bytes;
            default:
                bytes = new byte[9];
                bytes[0] = (byte) 255;
                Utils.int64ToByteArrayLE(value, bytes, 1);
                return bytes;
        }
    }
981787
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
  public Set<String> getAdvertisedMessageEncodings() {
    Set<String> advertisedDecompressors = new HashSet<>(decompressors.size());
    for (Entry<String, DecompressorInfo> entry : decompressors.entrySet()) {
      if (entry.getValue().advertised) {
        advertisedDecompressors.add(entry.getKey());
      }
    }
    return Collections.unmodifiableSet(advertisedDecompressors);
  }
1120259
public int readLength() throws IOException {
		int length = 0;

		byte b = (byte) this.read();

		// This is short form. The short form can be used if the number of
		// octets in the Value part is less than or
		// equal to 127, and can be used whether the Value part is primitive or
		// constructed. This form is identified by
		// encoding bit 8 as zero, with the length count in bits 7 to 1 (as
		// usual, with bit 7 the most significant bit
		// of the length).
		if ((b & 0x80) == 0) {
			return b;
		}

		// This is indefinite form. The indefinite form of length can only be
		// used (but does not have to be) if the V
		// part is constructed, that
		// is to say, consists of a series of TLVs. In the indefinite form of
		// length the first bit of the first octet is
		// set to 1, as for the long form, but the value N is set to zero.
		b = (byte) (b & 0x7F);
		if (b == 0) {
			return Tag.Indefinite_Length;
		}

		// If bit 8 of the first length octet is set to 1, then we have the long
		// form of length. In long form, the first
		// octet encodes in its remaining seven bits a value N which is the
		// length of a series of octets that themselves
		// encode the length of the Value part.
		byte temp;
		for (int i = 0; i < b; i++) {
			temp = (byte) this.read();
			length = (length << 8) | (0x00FF & temp);
		}

		return length;
	}
1105872
private int encodedSize() {
    int ans =
      16 /* for accessSchemaID, indices.length, varBias, setCases.length,
                          and getCases.length */
      + 2*indices.length; // for the elements in indices
    for (int i = 0; i < setCases.length; i++) {
      int[] cases = setCases[i];
      ans += 2; // for cases.length or null indicator
      if (cases != null)
        ans += 2 * cases.length;
    }
    for (int i = 0; i < getCases.length; i++) {
      int[] cases = getCases[i];
      ans += 2; // for cases.length or null indicator
      if (cases != null)
        ans += 2 * cases.length;
    }
    return ans;
  }
368798
public static String encodeBytes( byte[] source, int off, int len, boolean breakLines )
    {
        int    len43   = len * 4 / 3;
        byte[] outBuff = new byte[   ( len43 )                      // Main 4:3
                                   + ( (len % 3) > 0 ? 4 : 0 )      // Account for padding
                                   + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines      
        int d = 0;
        int e = 0;
        int len2 = len - 2;
        int lineLength = 0;
        for( ; d < len2; d+=3, e+=4 )
        {
            encode3to4( source, d+off, 3, outBuff, e );
            
            lineLength += 4;
            if( breakLines && lineLength == MAX_LINE_LENGTH )
            {   
                outBuff[e+4] = NEW_LINE;
                e++;
                lineLength = 0;
            }   // end if: end of line
        }   // en dfor: each piece of array
        
        if( d < len )
        {
            encode3to4( source, d+off, len - d, outBuff, e );
            e += 4;
        }   // end if: some padding needed
        
        return new String( outBuff, 0, e );
    }
1030927
@Override
    protected int readBytesWireFormat ( byte[] buffer, int bufferIndex ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        int structureSize = SMBUtil.readInt2(buffer, bufferIndex);
        if ( structureSize != 17 ) {
            throw new SMBProtocolDecodingException("Expected structureSize = 17");
        }
        bufferIndex += 4;

        this.count = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.remaining = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        bufferIndex += 4; // WriteChannelInfoOffset/WriteChannelInfoLength
        return bufferIndex - start;
    }
50787
public String readStringLengthEncoded(final Charset charset) {
    int length = (int) getLengthEncodedNumeric();
    String string = new String(buf, position, length, charset);
    position += length;
    return string;
  }
231436
function encodeLengthHex(n) {
    if (n<=127) return toHex(n)
    else {
        var n_hex = toHex(n)
        var length_of_length_byte = 128 + n_hex.length/2 // 0x80+numbytes
        return toHex(length_of_length_byte)+n_hex
    }
}
427862
public byte[] getEncodedInternal() throws IOException {
        if (encoded == null) {
            DerOutputStream     out = new DerOutputStream();
            DerOutputStream     tmp = new DerOutputStream();
            for (int i = 0; i < names.length; i++) {
                names[i].encode(tmp);
            }
            out.write(DerValue.tag_Sequence, tmp);
            encoded = out.toByteArray();
        }
        return encoded;
    }
104225
private int getByteLength(final Object val) {
		if (val == null) {
			return 0;
		}
		String str = val.toString();
		try {
			return str.getBytes(System.getProperty("file.encoding")).length;
		} catch (UnsupportedEncodingException ex) {
			return 1;
		}
	}
139421
public byte[] getEncoded() {
      if (this.isInfinity()) {
         return new byte[1];
      }

      int length = EcTools.getByteLength(_x);

      if (_compressed) {
         byte PC;

         if (this.getY().toBigInteger().testBit(0)) {
            PC = 0x03;
         } else {
            PC = 0x02;
         }

         byte[] X = EcTools.integerToBytes(this.getX().toBigInteger(), length);
         byte[] PO = new byte[X.length + 1];

         PO[0] = PC;
         System.arraycopy(X, 0, PO, 1, X.length);

         return PO;
      } else {
         byte[] X = EcTools.integerToBytes(this.getX().toBigInteger(), length);
         byte[] Y = EcTools.integerToBytes(this.getY().toBigInteger(), length);
         byte[] PO = new byte[X.length + Y.length + 1];

         PO[0] = 0x04;
         System.arraycopy(X, 0, PO, 1, X.length);
         System.arraycopy(Y, 0, PO, X.length + 1, Y.length);

         return PO;
      }
   }