public static Object readObj(final IBStream stream) {
        Object result;
        char ch = stream.peekChar();
        if (BConst.EOT == ch) {
            result = null;
        } else if (isDigit(ch)) {
            result = readByteArray(stream);
        } else if (BConst.INT_START == ch) {
            result = readInt(stream);
        } else if (BConst.LIST_START == ch) {
            result = readList(stream);
        } else if (BConst.DICT_START == ch) {
            result = readDictionary(stream);
        } else {
            throw new IllegalStateException(String.format("Unexpected symbol: %s.", ch));
        }
        return result;
    }