Replaces instances of getBytes() in apps classes

This commit is contained in:
z3r0fox
2015-12-20 02:11:42 +00:00
parent 2246e21340
commit b6bd497e52
24 changed files with 72 additions and 61 deletions

View File

@ -240,7 +240,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
}
if (user != null && pw != null) {
newRequest.append("Proxy-Authorization: Basic ")
.append(Base64.encode((user + ':' + pw).getBytes(), true)) // true = use standard alphabet
.append(Base64.encode(DataHelper.getUTF8(user + ':' + pw), true)) // true = use standard alphabet
.append("\r\n");
}
}
@ -265,7 +265,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
else
_log.warn(getPrefix(requestId) + "Auth required, sending 407");
}
out.write(getAuthError(result == AuthResult.AUTH_STALE).getBytes());
out.write(DataHelper.getASCII(getAuthError(result == AuthResult.AUTH_STALE)));
s.close();
return;
}

View File

@ -455,7 +455,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
if (allowGZIP && useGZIP) {
t = new CompressedRequestor(s, socket, modifiedHeader, getTunnel().getContext(), _log);
} else {
t = new I2PTunnelRunner(s, socket, slock, null, modifiedHeader.getBytes(),
t = new I2PTunnelRunner(s, socket, slock, null, DataHelper.getUTF8(modifiedHeader),
null, (I2PTunnelRunner.FailCallback) null);
}
// run in the unlimited client pool
@ -537,7 +537,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
if (_log.shouldLog(Log.INFO))
_log.info("request headers: " + _headers);
serverout.write(_headers.getBytes());
serverout.write(DataHelper.getUTF8(_headers));
browserin = _browser.getInputStream();
// Don't spin off a thread for this except for POSTs
// beware interference with Shoutcast, etc.?
@ -575,7 +575,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
Map<String, List<String>> headers = readHeaders(null, serverin, command,
SERVER_SKIPHEADERS, _ctx);
String modifiedHeaders = formatHeaders(headers, command);
compressedOut.write(modifiedHeaders.getBytes());
compressedOut.write(DataHelper.getUTF8(modifiedHeaders));
Sender s = new Sender(compressedOut, serverin, "server: server to browser", _log);
if (_log.shouldLog(Log.INFO))
@ -702,7 +702,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
//if (_log.shouldLog(Log.INFO))
// _log.info("Including x-i2p-gzip as the content encoding in the response");
if (shouldCompress())
out.write("Content-encoding: x-i2p-gzip\r\n".getBytes());
out.write(DataHelper.getASCII("Content-encoding: x-i2p-gzip\r\n"));
super.finishHeaders();
}

View File

@ -129,7 +129,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
this.cloakKey = new byte[Hash.HASH_LENGTH];
tunnel.getContext().random().nextBytes(this.cloakKey);
} else {
this.cloakKey = SHA256Generator.getInstance().calculateHash(passphrase.trim().getBytes()).getData();
this.cloakKey = SHA256Generator.getInstance().calculateHash(DataHelper.getUTF8(passphrase.trim())).getData();
}
// get the fake hostmask to use
@ -159,7 +159,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
modifiedRegistration = buf.toString();
}
Socket s = getSocket(socket.getPeerDestination().calculateHash(), socket.getLocalPort());
Thread t = new I2PTunnelRunner(s, socket, slock, null, modifiedRegistration.getBytes(),
Thread t = new I2PTunnelRunner(s, socket, slock, null, DataHelper.getUTF8(modifiedRegistration),
null, (I2PTunnelRunner.FailCallback) null);
// run in the unlimited client pool
//t.start();

View File

@ -55,7 +55,7 @@ public class SOCKSHeader {
this.header = new byte[beg.length + 60 + end.length];
System.arraycopy(this.header, 0, beg, 0, beg.length);
String b32 = dest.toBase32();
System.arraycopy(this.header, beg.length, b32.getBytes(), 0, 60);
System.arraycopy(this.header, beg.length, DataHelper.getASCII(b32), 0, 60);
System.arraycopy(this.header, beg.length + 60, end, 0, end.length);
}

View File

@ -12,6 +12,7 @@ import java.io.IOException;
import java.net.Socket;
import java.util.Properties;
import net.i2p.data.DataHelper;
import net.i2p.i2ptunnel.I2PTunnelHTTPClientBase;
/**
@ -63,7 +64,7 @@ public class SOCKSServerFactory {
case 'H':
case 'P':
DataOutputStream out = new DataOutputStream(s.getOutputStream());
out.write(ERR_REQUEST_DENIED.getBytes());
out.write(DataHelper.getASCII(ERR_REQUEST_DENIED));
throw new SOCKSException("HTTP request to socks");
default:
throw new SOCKSException("SOCKS protocol version not supported (" + Integer.toHexString(socksVer) + ")");