protected Object readNextElement()

in openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireStreamMessage.java [111:147]


    protected Object readNextElement(DataInput input) throws IOException {
        int type = input.readByte();
        if (type == -1) {
            throw new EOFException("Reached end of stream.");
        }

        if (type == OpenWireMarshallingSupport.NULL) {
            return null;
        } else if (type == OpenWireMarshallingSupport.BIG_STRING_TYPE) {
            return OpenWireMarshallingSupport.readUTF8(input);
        } else if (type == OpenWireMarshallingSupport.STRING_TYPE) {
            return input.readUTF();
        } else if (type == OpenWireMarshallingSupport.LONG_TYPE) {
            return Long.valueOf(input.readLong());
        } else if (type == OpenWireMarshallingSupport.INTEGER_TYPE) {
            return Integer.valueOf(input.readInt());
        } else if (type == OpenWireMarshallingSupport.SHORT_TYPE) {
            return Short.valueOf(input.readShort());
        } else if (type == OpenWireMarshallingSupport.BYTE_TYPE) {
            return Byte.valueOf(input.readByte());
        } else if (type == OpenWireMarshallingSupport.FLOAT_TYPE) {
            return new Float(input.readFloat());
        } else if (type == OpenWireMarshallingSupport.DOUBLE_TYPE) {
            return new Double(input.readDouble());
        } else if (type == OpenWireMarshallingSupport.BOOLEAN_TYPE) {
            return input.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
        } else if (type == OpenWireMarshallingSupport.CHAR_TYPE) {
            return Character.valueOf(input.readChar());
        } else if (type == OpenWireMarshallingSupport.BYTE_ARRAY_TYPE) {
            int len = input.readInt();
            byte[] value = new byte[len];
            input.readFully(value);
            return value;
        } else {
            throw new IOException("unknown type read from encoded stream.");
        }
    }