Replaces instances of getBytes() in core classes

This commit is contained in:
z3r0fox
2015-12-20 01:18:38 +00:00
parent 0b94d866f0
commit c60f3970d1
26 changed files with 57 additions and 49 deletions

View File

@@ -10,6 +10,7 @@ import java.io.IOException;
import java.util.Locale;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
/**
@@ -57,7 +58,7 @@ public class EepGetAndAddNamingService extends EepGetNamingService {
try {
fos = new FileOutputStream(f, true);
String line = hostname + '=' + rv.toBase64() + System.getProperty("line.separator");
fos.write(line.getBytes());
fos.write(DataHelper.getASCII(line));
} catch (IOException ioe) {
System.err.println("Error appending: " + ioe);
} finally {

View File

@@ -72,7 +72,7 @@ public class Base32 {
private static void runApp(String args[]) {
String cmd = args[0].toLowerCase(Locale.US);
if ("encodestring".equals(cmd)) {
System.out.println(encode(args[1].getBytes()));
System.out.println(encode(DataHelper.getUTF8(args[1])));
return;
}
InputStream in = System.in;
@@ -143,7 +143,7 @@ public class Base32 {
* @param source if null will return ""
*/
public static String encode(String source) {
return (source != null ? encode(source.getBytes()) : "");
return (source != null ? encode(DataHelper.getUTF8(source)) : "");
}
/**
@@ -210,7 +210,7 @@ public class Base32 {
* @return decoded data, null on error
*/
public static byte[] decode(String s) {
return decode(s.getBytes());
return decode(DataHelper.getASCII(s));
}
private final static byte[] dmask = { (byte) 0xf8, (byte) 0x7c, (byte) 0x3e, (byte) 0x1f,

View File

@@ -385,7 +385,7 @@ public class PrivateKeyFile {
hcs = hcs.substring(0, end1) + hcs.substring(start2);
System.out.println("Short Hashcash is: " + hcs);
c.setPayload(hcs.getBytes());
c.setPayload(DataHelper.getUTF8(hcs));
return c;
}

View File

@@ -114,7 +114,7 @@ public class HexDump {
}
}
out.write(" |".getBytes());
out.write(DataHelper.getASCII(" |"));
for (i = 0; i < FORMAT_BYTES_PER_ROW; ++i) {
if (i >= nextbytes) {