Changeset 1254
- Timestamp:
- Oct 22, 2010, 2:45:53 PM (13 years ago)
- Location:
- extensions/net.sf.basedb.torrent/trunk/src/external/hpbtc/hpbtc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.torrent/trunk/src/external/hpbtc/hpbtc/protocol/torrent/Torrent.java
r1248 r1254 3 3 import hpbtc.bencoding.BencodingReader; 4 4 import hpbtc.bencoding.BencodingWriter; 5 import hpbtc.util.IOUtil; 5 6 import hpbtc.util.TorrentUtil; 6 7 import java.io.ByteArrayOutputStream; … … 83 84 } 84 85 if (meta.containsKey("comment".getBytes(byteEncoding))) { 85 comment = new String((byte[]) meta.get("comment".getBytes( 86 byteEncoding)), byteEncoding); 86 comment = IOUtil.toString((byte[])meta.get("comment".getBytes(byteEncoding)), byteEncoding); 87 87 } 88 88 if (meta.containsKey("created by".getBytes(byteEncoding))) { 89 createdBy = new String((byte[]) meta.get("created by".getBytes( 90 byteEncoding)), byteEncoding); 89 createdBy = IOUtil.toString((byte[])meta.get("created by".getBytes(byteEncoding)), byteEncoding); 91 90 } 92 91 if (meta.containsKey("encoding".getBytes(byteEncoding))) { 93 encoding = new String((byte[]) meta.get("encoding".getBytes( 94 byteEncoding)), byteEncoding); 92 encoding = IOUtil.toString((byte[])meta.get("encoding".getBytes(byteEncoding)), byteEncoding); 95 93 } 96 94 final boolean multiple = -
extensions/net.sf.basedb.torrent/trunk/src/external/hpbtc/hpbtc/util/IOUtil.java
r1248 r1254 8 8 import java.io.IOException; 9 9 import java.io.RandomAccessFile; 10 import java.io.UnsupportedEncodingException; 10 11 import java.net.InetSocketAddress; 11 12 import java.nio.ByteBuffer; … … 21 22 public class IOUtil { 22 23 24 25 public static String toString(byte[] bytes, String encoding) 26 throws UnsupportedEncodingException 27 { 28 return bytes == null ? null : new String(bytes, encoding); 29 } 30 31 23 32 public static InetSocketAddress getAddress(final SocketChannel c) { 24 33 return (InetSocketAddress) c.socket().getRemoteSocketAddress();
Note: See TracChangeset
for help on using the changeset viewer.