Examples of BDecoder


Examples of com.torrent4j.util.bencoding.BDecoder

   * @return the loaded {@link Torrent} instance
   * @throws IOException
   *             if any error occur while reading the torrent file
   */
  public static Torrent load(InputStream in) throws IOException {
    final Object node = new BDecoder(in).readElement();
    final TorrentMetadata metadata = new TorrentMetadata((BMap) node);
    return new Torrent(metadata);
  }
View Full Code Here

Examples of net.yacy.kelondro.util.BDecoder

        try {
            b = FileUtils.read(source);
        } catch (IOException e1) {
            throw new Parser.Failure(e1.toString(), location);
        }
        final BDecoder bd = new BDecoder(b);
        final BObject bo = bd.parse();
        if (bo == null) throw new Parser.Failure("BDecoder.parse returned null", location);
        if (bo.getType() != BType.dictionary) throw new Parser.Failure("BDecoder object is not a dictionary", location);
        final Map<String, BObject> map = bo.getMap();
        final BObject commento = map.get("comment");
        final String comment = (commento == null) ? "" : UTF8.String(commento.getString());
View Full Code Here

Examples of net.yacy.kelondro.util.BDecoder

    }
   
    private static Map<String, byte[]> b2m(byte[] b) {
        if (b == null) return null;
        //System.out.println("b = " + UTF8.String(b));
        BDecoder decoder = new BDecoder(b);
        BObject bobj = decoder.parse();
        if (bobj.getType() != BDecoder.BType.dictionary) return null;
        Map<String, BDecoder.BObject> map = bobj.getMap();
        Map<String, byte[]> m = new HashMap<String, byte[]>();
        for (Map.Entry<String, BDecoder.BObject> entry: map.entrySet()) {
            if (entry.getValue().getType() != BDecoder.BType.string) continue;
View Full Code Here

Examples of net.yacy.kelondro.util.BDecoder

        try {
            b = FileUtils.read(source);
        } catch (IOException e1) {
            throw new Parser.Failure(e1.toString(), location);
        }
        final BDecoder bd = new BDecoder(b);
        final BObject bo = bd.parse();
        if (bo == null) throw new Parser.Failure("BDecoder.parse returned null", location);
        if (bo.getType() != BType.dictionary) throw new Parser.Failure("BDecoder object is not a dictionary", location);
        final Map<String, BObject> map = bo.getMap();
        final BObject commento = map.get("comment");
        final String comment = (commento == null) ? "" : UTF8.String(commento.getString());
View Full Code Here

Examples of net.yacy.kelondro.util.BDecoder

    }

    private static Map<String, byte[]> b2m(final byte[] b) {
        if (b == null) return null;
        //System.out.println("b = " + UTF8.String(b));
        final BDecoder decoder = new BDecoder(b);
        final BObject bobj = decoder.parse();
        if (bobj.getType() != BDecoder.BType.dictionary) return null;
        final Map<String, BDecoder.BObject> map = bobj.getMap();
        final Map<String, byte[]> m = new HashMap<String, byte[]>();
        for (final Map.Entry<String, BDecoder.BObject> entry: map.entrySet()) {
            if (entry.getValue().getType() != BDecoder.BType.string) continue;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.