@SuppressWarnings({ "unchecked", "rawtypes" })
	public static final byte[] encode(Object o) throws BencodingException
    {
        if(o instanceof HashMap)
            return encodeDictionary((HashMap)o);
        else if(o instanceof ArrayList)
            return encodeList((ArrayList)o);
        else if(o instanceof Integer)
            return encodeInteger((Integer)o);
        else if(o instanceof ByteBuffer)
            return encodeString((ByteBuffer)o);
        else
            throw new BencodingException("Error: Object not of valid type for Bencoding.");
    }