The decode method turns an ObjectInput into a Selector tree.

@param buf the DataInput containing the encoding of the tree

@exception IOException when presented with an illformed encoding or other error
342827
public static Selector decode(ObjectInput buf) throws IOException
  {
    if (buf.readByte() != VERSION)
      throw new IOException();
    try
    {
      return decodeSubtree(buf);
    }
    catch (Exception e)
    {
      // No FFDC Code Needed.
      // FFDC driven by wrapper class.      
      FFDC.processException(cclass,
          "com.ibm.ws.sib.matchspace.selector.impl.Selector.decode",
          e,
          "1:191:1.19");
//TODO: include buf as parameter               
      throw new IllegalArgumentException();
    }
  }
123591
public void toRSL(StringBuffer buf, boolean explicitConcat) {
	Iterator iter;

	buf.append( getOperatorAsString() );

	if (_bindings != null && _bindings.size() > 0) {
	    iter = _bindings.keySet().iterator();
	    Bindings binds;
	    while( iter.hasNext() ) {
		binds = getBindings( (String)iter.next() );
		binds.toRSL(buf, explicitConcat);
	    }
	}

	if (_relations != null && _relations.size() > 0) {
	    iter = _relations.keySet().iterator();
	    NameOpValue nov;
	    while(iter.hasNext()) {
		nov = getParam( (String)iter.next() );
		nov.toRSL(buf, explicitConcat);
	    }
	}

	if (_specifications != null && _specifications.size() > 0) {
	    iter = _specifications.iterator();
	    AbstractRslNode node;
	    while(iter.hasNext()) {
		node = (AbstractRslNode)iter.next();
		buf.append(" (");
		node.toRSL(buf, explicitConcat);
		buf.append(" )");
	    }
	}
    }
1291237
@Override
  public T decode(final byte[] buffer) {
    try (final ByteArrayInputStream bis = new ByteArrayInputStream(buffer);
         final DataInputStream dis = new DataInputStream(bis)) {
      final T writable = this.writableClass.newInstance();
      writable.readFields(dis);
      return writable;
    } catch (final IOException | InstantiationException | IllegalAccessException ex) {
      LOG.log(Level.SEVERE, "Cannot decode class " + this.writableClass, ex);
      throw new RemoteRuntimeException(ex);
    }
  }
771789
public static BitSet decodeBitString(ByteBuffer buf) {
        DerId id = DerId.decode(buf);
        if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE, ASN1_BIT_STRING_TAG_NUM)
                && !id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.CONSTRUCTED, ASN1_BIT_STRING_TAG_NUM)) {
            throw new IllegalArgumentException("Expected BIT STRING identifier, received " + id);
        }
        int len = DerUtils.decodeLength(buf);
        if (buf.remaining() < len) {
            throw new IllegalArgumentException("Insufficient content for BIT STRING");
        }

        // If primitive encoding, then the initial octet is just used for padding
        if (id.getEncodingType() == DerId.EncodingType.PRIMITIVE) {
            buf.get();
            len--;
        }

        int nbits = len * 8;
        BitSet bits = new BitSet(nbits);
        for (int i = 0; i < len; i++) {
            short next = (short) (0xff & buf.get());
            int bitIndex = (i + 1) * 8 - 1;
            while (next != 0) {
                if ((next & 1) == 1) {
                    bits.set(bitIndex);
                }
                bitIndex--;
                next >>>= 1;
            }
        }
        return bits;
    }
1220038
@Override
    protected void decode(DataInputStream buffer) throws IOException
    {
        entityId = buffer.readShort();
        final int number = buffer.readByte();
        for (int i = 0; i < number; i++)
        {
            decode(buffer, i);
        }
    }
631204
public AsciiString decode(ByteBuf buf, int length) throws Http2Exception {
        processor.reset();
        buf.forEachByte(buf.readerIndex(), length, processor);
        buf.skipBytes(length);
        return processor.end();
    }
136415
@Override
    public void encode(final OtpOutputStream buf) {
        final int arity = arity();

        buf.write_map_head(arity);

        for (final Map.Entry<OtpErlangObject, OtpErlangObject> e : entrySet()) {
            buf.write_any(e.getKey());
            buf.write_any(e.getValue());
        }
    }
1278700
@Override
  public NamingLookupResponse decode(final byte[] buf) {
    final AvroNamingLookupResponse avroResponse = AvroUtils.fromBytes(buf, AvroNamingLookupResponse.class);
    final List<NameAssignment> nas = new ArrayList<>(avroResponse.getTuples().size());
    for (final AvroNamingAssignment tuple : avroResponse.getTuples()) {
      nas.add(
          new NameAssignmentTuple(
              factory.getNewInstance(tuple.getId().toString()),
              new InetSocketAddress(tuple.getHost().toString(), tuple.getPort())
          )
      );
    }
    return new NamingLookupResponse(nas);
  }
121000
public static String toStringBinary(ByteBuffer buf) {
    if (buf == null) {
      return "null";
    }
    return toStringBinary(buf.array(), buf.arrayOffset(), buf.limit());
  }
389736
function amf0decObject(buf) { // TODO: Implement references!
    var obj = {};
    var iBuf = buf.slice(1);
    var len = 1;
//    console.log('ODec',iBuf.readUInt8(0));
    while (iBuf.readUInt8(0) != 0x09) {
        // console.log('Field', iBuf.readUInt8(0), iBuf);
        var prop = amf0decUString(iBuf);
        // console.log('Got field for property', prop);
        len += prop.len;
        if (iBuf.slice(prop.len).readUInt8(0) == 0x09) {
            len++;
            // console.log('Found the end property');
            break;
        } // END Object as value, we shall leave
        if (prop.value == '') break;
        var val = amf0DecodeOne(iBuf.slice(prop.len));
        // console.log('Got field for value', val);
        obj[prop.value] = val.value;
        len += val.len;
        iBuf = iBuf.slice(prop.len + val.len);
    }
    return { len: len, value: obj }
}
1184700
public void checkcast(TypeElement objectref) throws IOException
    {
        int index = subClass.resolveClassIndex(objectref);
        checkcast(index);
    }
258124
public static int decodeSequence(ByteBuffer buf) {
        DerId id = DerId.decode(buf);
        if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.CONSTRUCTED, ASN1_SEQUENCE_TAG_NUM)) {
            throw new IllegalArgumentException("Expected SEQUENCE identifier, received " + id);
        }
        int len = DerUtils.decodeLength(buf);
        if (buf.remaining() < len) {
            throw new IllegalArgumentException("Insufficient content for SEQUENCE");
        }
        return len;
    }
48162
function decode(buf) {
  let off = 0;
  var i;

  // unpack meta
  const meta = buf[(off += 1)];
  // const VERSION = meta >> 4;
  const argv = meta & 0xf;
  const args = new Array(argv);

  // unpack args
  for (i = 0; i < argv; i += 1) {
    const len = buf.readUInt32BE(off);
    off += 4;

    args[i] = buf.slice(off, (off += len));
  }

  return args;
}
83918
function toBuffer(buf) {
  if (buf instanceof ArrayBuffer) {
    return arrayBufferToBuffer(buf);
  } else if (Buffer.isBuffer(buf)) {
    return buf;
  } else if (buf instanceof Uint8Array) {
    return new Buffer(buf);
  } else {
    return buf; // type unknown, trust the user
  }
}
620493
public GatewayMessage decode(ByteBuf byteBuf) throws MessageCodecException {
    try (InputStream stream = new ByteBufInputStream(byteBuf, true)) {
      JsonParser jp = jsonFactory.createParser(stream);
      GatewayMessage.Builder result = GatewayMessage.builder();

      JsonToken current = jp.nextToken();
      if (current != JsonToken.START_OBJECT) {
        throw new MessageCodecException("Root should be object", null);
      }
      long dataStart = 0;
      long dataEnd = 0;
      while ((jp.nextToken()) != JsonToken.END_OBJECT) {
        String fieldName = jp.getCurrentName();
        current = jp.nextToken();
        if (current == VALUE_NULL) {
          continue;
        }

        if (fieldName.equals(DATA_FIELD)) {
          dataStart = jp.getTokenLocation().getByteOffset();
          if (current.isScalarValue()) {
            if (!current.isNumeric() && !current.isBoolean()) {
              jp.getValueAsString();
            }
          } else if (current.isStructStart()) {
            jp.skipChildren();
          }
          dataEnd = jp.getCurrentLocation().getByteOffset();
        } else {
          // headers
          result.header(fieldName, jp.getValueAsString());
        }
      }
      // data
      if (dataEnd > dataStart) {
        result.data(byteBuf.copy((int) dataStart, (int) (dataEnd - dataStart)));
      }
      return result.build();
    } catch (Throwable ex) {
      throw new MessageCodecException("Failed to decode message", ex);
    }
  }
722939
public void write(io.netty.buffer.ByteBuf buf) throws IOException {
    write(buf, 0, buf.readableBytes());
  }
825956
public int read(byte []buf, int offset, int length) throws IOException
  {
    if (_is == null)
      return -1;

    int len = _is.read(buf, offset, length);

    return len;
  }