private TorrentInfoSection (
        long pieceLength, List<Sha1Hash> pieceHashes, boolean priv, String baseDir, List<TorrentFileInfo> files,
        Sha1Hash hash, String name)
    {
        if ((baseDir == null | hash == null | name == null) || pieceHashes.contains(null) || files.contains(null)) {
            throw new NullPointerException();
        }

        if (pieceLength < 0) {
            throw new IllegalArgumentException();
        }

        this.pieceLength = pieceLength;
        this.priv = priv;
        this.baseDir = baseDir;
        this.hash = hash;
        this.pieceHashes = Collections.unmodifiableList(new ArrayList<Sha1Hash>(pieceHashes));
        this.files = Collections.unmodifiableList(new ArrayList<TorrentFileInfo>(files));
        this.name = name;

        long totalLength = 0;
        for (TorrentFileInfo tfi : files) {
            fileInfos.put(tfi.getPath(), tfi);
            totalLength += tfi.getLength();
        }
        this.totalLength = totalLength;
    }