ClassRef classRef;
Short buf = in.readShort();
// if the most significant bit is 0 it's a internal class ref
if ((buf & 0x8000) >>> 15 == 0) {
classRef = new InternalClassRef();
((InternalClassRef) classRef).setInternalClassRef(buf);
} else {
// case of an external class ref
classRef = new ExternalClassRef();
((ExternalClassRef) classRef).setClassToken(buf.byteValue());