forked from I2P_Developers/i2p.i2p
cleanup buf.append(s.substring(a, b)) -> buf.append(s, a, b)
all over, for object churn
This commit is contained in:
@@ -697,7 +697,7 @@ class Daemon {
|
||||
StringBuilder buf = new StringBuilder(16);
|
||||
final int sz = dests.size();
|
||||
for (int i = 0; i < sz; i++) {
|
||||
buf.append(dests.get(i).toBase64().substring(0, 6));
|
||||
buf.append(dests.get(i).toBase64(), 0, 6);
|
||||
if (i != sz - 1)
|
||||
buf.append(", ");
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class FileDumpHelper extends HelperBase {
|
||||
buf.append("<br>");
|
||||
if (linkrev)
|
||||
buf.append("<a href=\"").append(LINK).append(s).append("\">");
|
||||
buf.append("<span class=\"revision\"><tt>").append(s.substring(0, 20)).append("</tt>" +
|
||||
buf.append("<span class=\"revision\"><tt>").append(s, 0, 20).append("</tt>" +
|
||||
"<br>" +
|
||||
"<tt>").append(s.substring(20)).append("</tt></span>");
|
||||
if (linkrev)
|
||||
|
||||
@@ -730,7 +730,7 @@ class NetDbRenderer {
|
||||
buf.append(" <b>(").append(_t("Encrypted")).append(")</b>");
|
||||
buf.append("</th>");
|
||||
if (_context.clientManager().isLocal(key)) {
|
||||
buf.append("<th><a href=\"tunnels#" + key.toBase64().substring(0,4) + "\">" + _t("Local") + "</a> ");
|
||||
buf.append("<th><a href=\"tunnels#").append(key.toBase64(), 0, 4).append("\">").append(_t("Local")).append("</a> ");
|
||||
boolean unpublished = ! _context.clientManager().shouldPublishLeaseSet(key);
|
||||
if (unpublished)
|
||||
buf.append("<b>").append(_t("Unpublished")).append("</b> ");
|
||||
@@ -739,7 +739,7 @@ class NetDbRenderer {
|
||||
if (in != null && in.getDestinationNickname() != null)
|
||||
buf.append(DataHelper.escapeHTML(in.getDestinationNickname()));
|
||||
else
|
||||
buf.append(dest.toBase64().substring(0, 6));
|
||||
buf.append(dest.toBase64(), 0, 6);
|
||||
buf.append("</th></tr>\n");
|
||||
// we don't show a b32 or addressbook links if encrypted
|
||||
if (type != DatabaseEntry.KEY_TYPE_ENCRYPTED_LS2) {
|
||||
@@ -772,7 +772,7 @@ class NetDbRenderer {
|
||||
String b32 = key.toBase32();
|
||||
buf.append("<code>");
|
||||
if (dest != null)
|
||||
buf.append(dest.toBase64().substring(0, 6));
|
||||
buf.append(dest.toBase64(), 0, 6);
|
||||
else
|
||||
buf.append("n/a");
|
||||
buf.append("</code></th>" +
|
||||
@@ -839,7 +839,7 @@ class NetDbRenderer {
|
||||
}
|
||||
if (type == DatabaseEntry.KEY_TYPE_LEASESET) {
|
||||
buf.append("</td></tr>\n<tr><td colspan=\"2\"><b>Encryption Key:</b> ELGAMAL_2048 ")
|
||||
.append(ls.getEncryptionKey().toBase64().substring(0, 20))
|
||||
.append(ls.getEncryptionKey().toBase64(), 0, 20)
|
||||
.append("…");
|
||||
} else if (type == DatabaseEntry.KEY_TYPE_LS2) {
|
||||
LeaseSet2 ls2 = (LeaseSet2) ls;
|
||||
@@ -851,7 +851,7 @@ class NetDbRenderer {
|
||||
else
|
||||
buf.append("Unsupported type ").append(pk.getUnknownTypeCode());
|
||||
buf.append(' ')
|
||||
.append(pk.toBase64().substring(0, 20))
|
||||
.append(pk.toBase64(), 0, 20)
|
||||
.append("…");
|
||||
}
|
||||
}
|
||||
@@ -1183,7 +1183,7 @@ class NetDbRenderer {
|
||||
private void renderRouterInfo(StringBuilder buf, RouterInfo info, boolean isUs, boolean full) {
|
||||
String hash = info.getIdentity().getHash().toBase64();
|
||||
buf.append("<table class=\"netdbentry\">" +
|
||||
"<tr id=\"").append(hash.substring(0, 6)).append("\"><th colspan=\"2\"");
|
||||
"<tr id=\"").append(hash, 0, 6).append("\"><th colspan=\"2\"");
|
||||
if (isUs) {
|
||||
buf.append(" id=\"our-info\"><b>").append(_t("Our Router Identity")).append(":</b> <code>")
|
||||
.append(hash).append("</code></th><th>");
|
||||
@@ -1199,7 +1199,7 @@ class NetDbRenderer {
|
||||
}
|
||||
if (!full) {
|
||||
buf.append("<a title=\"").append(_t("View extended router info"))
|
||||
.append("\" class=\"viewfullentry\" href=\"netdb?r=").append(hash.substring(0, 6))
|
||||
.append("\" class=\"viewfullentry\" href=\"netdb?r=").append(hash, 0, 6)
|
||||
.append("\" >[").append(_t("Full entry")).append("]</a>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,7 +635,7 @@ public class SummaryHelper extends HelperBase {
|
||||
buf.append("server.png\" alt=\"Server\" title=\"").append(_t("Hidden Service")).append("\">");
|
||||
else
|
||||
buf.append("client.png\" alt=\"Client\" title=\"").append(_t("Client")).append("\">");
|
||||
buf.append("</td><td align=\"left\"><b><a href=\"tunnels#").append(h.toBase64().substring(0,4));
|
||||
buf.append("</td><td align=\"left\"><b><a href=\"tunnels#").append(h.toBase64(), 0, 4);
|
||||
buf.append("\" target=\"_top\" title=\"").append(_t("Show tunnels")).append("\">");
|
||||
// Increase permitted max length of tunnel name & handle overflow with css
|
||||
if (name.length() <= 32)
|
||||
|
||||
@@ -309,14 +309,14 @@ class PacketLocal extends Packet implements MessageOutputStream.WriteStatus {
|
||||
buf.append(" from ");
|
||||
Destination local = _session.getMyDestination();
|
||||
if (local != null)
|
||||
buf.append(local.calculateHash().toBase64().substring(0,4));
|
||||
buf.append(local.calculateHash().toBase64(), 0, 4);
|
||||
else
|
||||
buf.append("unknown");
|
||||
|
||||
buf.append(" to ");
|
||||
Destination remote = con.getRemotePeer();
|
||||
if (remote != null)
|
||||
buf.append(remote.calculateHash().toBase64().substring(0,4));
|
||||
buf.append(remote.calculateHash().toBase64(), 0, 4);
|
||||
else
|
||||
buf.append("unknown");
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class HeaderLine extends Encoding {
|
||||
return str + "\r\n";
|
||||
// Output encoded.
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(str.substring(0, l));
|
||||
out.append(str, 0, l);
|
||||
int start = l;
|
||||
StringBuilder qc = new StringBuilder(16);
|
||||
for (int i = start; i < str.length(); i++) {
|
||||
|
||||
@@ -1935,7 +1935,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
|
||||
StringBuilder buf = new StringBuilder(32);
|
||||
buf.append("Session: ");
|
||||
if (_myDestination != null)
|
||||
buf.append(_myDestination.calculateHash().toBase64().substring(0, 4));
|
||||
buf.append(_myDestination.calculateHash().toBase64(), 0, 4);
|
||||
else
|
||||
buf.append("[null dest]");
|
||||
buf.append(getPrefix());
|
||||
|
||||
@@ -935,7 +935,7 @@ public abstract class Addresses {
|
||||
buf.setLength(0);
|
||||
int i = 0;
|
||||
while(true) {
|
||||
buf.append(as.substring(i, i+4));
|
||||
buf.append(as, i, i+4);
|
||||
i += 4;
|
||||
if (i >= 32)
|
||||
break;
|
||||
@@ -1130,7 +1130,7 @@ public abstract class Addresses {
|
||||
for (String m : _macCache) {
|
||||
int i = 0;
|
||||
while(true) {
|
||||
buf.append(m.substring(i, i+2));
|
||||
buf.append(m, i, i+2);
|
||||
i += 2;
|
||||
if (i >= 12)
|
||||
break;
|
||||
|
||||
@@ -228,7 +228,7 @@ class PeerTestJob extends JobImpl {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(64);
|
||||
buf.append("Test peer ").append(_peer.toBase64().substring(0,4));
|
||||
buf.append("Test peer ").append(_peer.toBase64(), 0, 4);
|
||||
buf.append(" with nonce ").append(_nonce);
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ class PacketBuilder {
|
||||
StringBuilder msg = null;
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
msg = new StringBuilder(128);
|
||||
msg.append("building ACK packet to ").append(peer.getRemotePeer().toBase64().substring(0,6));
|
||||
msg.append("building ACK packet to ").append(peer.getRemotePeer().toBase64(), 0, 6);
|
||||
}
|
||||
|
||||
int fullACKCount = 0;
|
||||
|
||||
@@ -2447,7 +2447,7 @@ public class PeerState {
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
buf.append(_remoteHostId.toString());
|
||||
buf.append(' ').append(_remotePeer.toBase64().substring(0,6));
|
||||
buf.append(' ').append(_remotePeer.toBase64(), 0, 6);
|
||||
|
||||
if (getVersion() == 2)
|
||||
buf.append(_isInbound? " IB2 " : " OB2 ");
|
||||
|
||||
@@ -266,7 +266,7 @@ class PeerTestState {
|
||||
buf.append("me ");
|
||||
buf.append(_aliceIP).append(':').append(_alicePort);
|
||||
if (_aliceHash != null)
|
||||
buf.append(' ').append(_aliceHash.toBase64().substring(0, 6));
|
||||
buf.append(' ').append(_aliceHash.toBase64(), 0, 6);
|
||||
}
|
||||
if (_aliceIPFromCharlie != null)
|
||||
buf.append(" (fromCharlie ").append(_aliceIPFromCharlie).append(':').append(_alicePortFromCharlie).append(')');
|
||||
@@ -281,7 +281,7 @@ class PeerTestState {
|
||||
} else {
|
||||
buf.append(_charlieIP).append(':').append(_charliePort);
|
||||
if (_charlieHash != null)
|
||||
buf.append(' ').append(_charlieHash.toBase64().substring(0, 6));
|
||||
buf.append(' ').append(_charlieHash.toBase64(), 0, 6);
|
||||
}
|
||||
if (_previousCharlies != null && !_previousCharlies.isEmpty())
|
||||
buf.append(" previous: ").append(_previousCharlies);
|
||||
|
||||
@@ -290,7 +290,7 @@ class FragmentedMessage {
|
||||
buf.append(" last received? ").append(_lastReceived);
|
||||
buf.append(" lifetime: ").append(DataHelper.formatDuration(_context.clock().now()-_createdOn));
|
||||
if (_toRouter != null) {
|
||||
buf.append(" targetting ").append(_toRouter.toBase64().substring(0,4));
|
||||
buf.append(" targetting ").append(_toRouter.toBase64(), 0, 4);
|
||||
if (_toTunnel != null)
|
||||
buf.append(":").append(_toTunnel.getTunnelId());
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class HopConfig {
|
||||
buf.append(_receiveTunnel.getTunnelId());
|
||||
}
|
||||
if (_sendTo != null) {
|
||||
buf.append(" send to ").append(_sendTo.toBase64().substring(0,4)).append(":");
|
||||
buf.append(" send to ").append(_sendTo.toBase64(), 0, 4).append(":");
|
||||
if (_sendTunnel != null)
|
||||
buf.append(_sendTunnel.getTunnelId());
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ public abstract class TunnelCreatorConfig implements TunnelInfo {
|
||||
buf.append(" client ").append(Base64.encode(_destination.getData(), 0, 3));
|
||||
buf.append(": GW ");
|
||||
for (int i = 0; i < _peers.length; i++) {
|
||||
buf.append(_peers[i].toBase64().substring(0,4));
|
||||
buf.append(_peers[i].toBase64(), 0, 4);
|
||||
long id = _config[i].getReceiveTunnelId();
|
||||
if (id != 0) {
|
||||
// don't show for "me" at OBGW or IBEP
|
||||
|
||||
@@ -1338,7 +1338,7 @@ public class TunnelPool {
|
||||
if (_settings.getDestinationNickname() != null)
|
||||
rv.append(_settings.getDestinationNickname());
|
||||
else
|
||||
rv.append(_settings.getDestination().toBase64().substring(0,4));
|
||||
rv.append(_settings.getDestination().toBase64(), 0, 4);
|
||||
return rv.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user