I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit b97ad6c5 authored by zzz's avatar zzz
Browse files

generics

parent 97f0c13c
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,7 @@ public class BEncoder
else if (o instanceof List)
bencode((List)o, out);
else if (o instanceof Map)
bencode((Map)o, out);
bencode((Map<String, Object>)o, out);
else if (o instanceof BEValue)
bencode(((BEValue)o).getValue(), out);
else
......@@ -153,7 +153,7 @@ public class BEncoder
out.write(bs);
}
public static byte[] bencode(Map m)
public static byte[] bencode(Map<String, Object> m)
{
try
{
......@@ -167,20 +167,20 @@ public class BEncoder
}
}
public static void bencode(Map m, OutputStream out) throws IOException
public static void bencode(Map<String, Object> m, OutputStream out) throws IOException
{
out.write('d');
// Keys must be sorted. XXX - But is this the correct order?
Set s = m.keySet();
List l = new ArrayList(s);
Set<String> s = m.keySet();
List<String> l = new ArrayList(s);
Collections.sort(l);
Iterator it = l.iterator();
Iterator<String> it = l.iterator();
while(it.hasNext())
{
// Keys must be Strings.
String key = (String)it.next();
String key = it.next();
Object value = m.get(key);
bencode(key, out);
bencode(value, out);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment