trackerBT
Class BDecoder

java.lang.Object
  extended by trackerBT.BDecoder

public class BDecoder
extends java.lang.Object

A set of utility methods to decode a bencoded array of byte into a Map. integer are represented as Long, String as byte[], dictionnaries as Map, and list as List.


Field Summary
private  boolean recovery_mode
           
 
Constructor Summary
BDecoder()
           
 
Method Summary
static java.util.Map decode(java.io.BufferedInputStream is)
           
static java.util.Map decode(byte[] data)
           
private  java.util.Map decode(java.io.ByteArrayInputStream data)
           
 java.util.Map decodeByteArray(byte[] data)
           
private  java.lang.Object decodeInputStream(java.io.InputStream bais, int nesting)
           
 java.util.Map decodeStream(java.io.BufferedInputStream data)
           
private  byte[] getByteArrayFromStream(java.io.InputStream bais)
           
private  long getNumberFromStream(java.io.InputStream bais, char parseChar)
           
private  long getNumberFromStreamOld(java.io.InputStream bais, char parseChar)
           
static void main(java.lang.String[] args)
           
private static void print(java.io.File f, java.io.File output)
           
private  void print(java.io.PrintWriter writer, java.lang.Object obj)
           
private  void print(java.io.PrintWriter writer, java.lang.Object obj, java.lang.String indent, boolean skip_indent)
           
 void setRecoveryMode(boolean r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recovery_mode

private boolean recovery_mode
Constructor Detail

BDecoder

public BDecoder()
Method Detail

decode

public static java.util.Map decode(java.io.BufferedInputStream is)
                            throws java.io.IOException
Throws:
java.io.IOException

decode

public static java.util.Map decode(byte[] data)
                            throws java.io.IOException
Throws:
java.io.IOException

decode

private java.util.Map decode(java.io.ByteArrayInputStream data)
                      throws java.io.IOException
Throws:
java.io.IOException

decodeByteArray

public java.util.Map decodeByteArray(byte[] data)
                              throws java.io.IOException
Throws:
java.io.IOException

decodeInputStream

private java.lang.Object decodeInputStream(java.io.InputStream bais,
                                           int nesting)
                                    throws java.io.IOException
Throws:
java.io.IOException

decodeStream

public java.util.Map decodeStream(java.io.BufferedInputStream data)
                           throws java.io.IOException
Throws:
java.io.IOException

getByteArrayFromStream

private byte[] getByteArrayFromStream(java.io.InputStream bais)
                               throws java.io.IOException
Throws:
java.io.IOException

getNumberFromStream

private long getNumberFromStream(java.io.InputStream bais,
                                 char parseChar)
                          throws java.io.IOException
Throws:
java.io.IOException

getNumberFromStreamOld

private long getNumberFromStreamOld(java.io.InputStream bais,
                                    char parseChar)
                             throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)

print

private static void print(java.io.File f,
                          java.io.File output)

print

private void print(java.io.PrintWriter writer,
                   java.lang.Object obj)

print

private void print(java.io.PrintWriter writer,
                   java.lang.Object obj,
                   java.lang.String indent,
                   boolean skip_indent)

setRecoveryMode

public void setRecoveryMode(boolean r)