i2psnark: Restore 2-arg getNameAndInfoHash()

used by i2psnark-rpc plugin
This commit is contained in:
zzz committed 2026-09-09 15:00:39 -04:00
1 parent 2f0fb93e83
commit 3f17761c86
1 file changed
+13 -1
@@ -430,6 +430,18 @@ public class MetaInfo
info_hash = calculateInfoHash();
}
/**
* Efficiently returns the name and the 20 byte SHA1 hash of the info dictionary in a torrent file.
* Caller must close stream.
* Unused within snark, used by i2psnark-rpc plugin.
*
* @param infoHashOut 20-byte out parameter
* @since 0.8.5
*/
public static String getNameAndInfoHash(InputStream in, byte[] infoHashOut) throws IOException {
return getNameAndInfoHash(in, infoHashOut, new AtomicLong());
}
/**
* Efficiently returns the name and the 20 byte SHA1 hash of the info dictionary in a torrent file,
* and approximate total length.
@@ -437,7 +449,7 @@ public class MetaInfo
*
* @param infoHashOut 20-byte out parameter
* @param lengthOut out parameter approximate, not exact
* @since 0.8.5
* @since 0.9.71
*/
public static String getNameAndInfoHash(InputStream in, byte[] infoHashOut, AtomicLong lengthOut) throws IOException {
BDecoder bd = new BDecoder(in);