public static NBTTagCompound parseNBTStream(InputStream is) throws IOException {
        if (is == null) {
            throw new IllegalArgumentException("Input stream must not be null");
        }

        DataInputStream in = null;

        if (is instanceof DataInputStream) {
            in = (DataInputStream) is;
        } else {
            in = new DataInputStream(is);
        }

        NBTKeyValuePair tag = getTagUnknown(in, true);
        if (tag != null && tag.getValue() instanceof NBTTagCompound) {
            return (NBTTagCompound) tag.getValue();
        } else {
            return null;
        }
    }