Changeset b6bd497


Ignore:
Timestamp:
Dec 20, 2015 2:11:42 AM (5 years ago)
Author:
z3r0fox <z3r0fox@…>
Branches:
master
Children:
074c5aa1
Parents:
2246e21
Message:

Replaces instances of getBytes() in apps classes

Location:
apps
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • apps/BOB/Demos/echo/echoclient/src/net/i2p/BOB/Demos/echo/echoclient/Main.java

    r2246e21 rb6bd497  
    6767
    6868        static void wrtxt(OutputStream CMDout, String s) throws IOException {
    69                 CMDout.write(s.getBytes());
     69                CMDout.write(DataHelper.getUTF8(s));
    7070                CMDout.write('\n');
    7171                CMDout.flush();
  • apps/BOB/Demos/echo/echoserver/src/net/i2p/BOB/Demos/echo/echoserver/Main.java

    r2246e21 rb6bd497  
    6464
    6565        static void wrtxt(OutputStream CMDout, String s) throws IOException {
    66                 CMDout.write(s.getBytes());
     66                CMDout.write(DataHelper.getUTF8(s));
    6767                CMDout.write('\n');
    6868                CMDout.flush();
  • apps/BOB/src/net/i2p/BOB/I2PtoTCP.java

    r2246e21 rb6bd497  
    2222
    2323import net.i2p.client.streaming.I2PSocket;
     24import net.i2p.data.DataHelper;
    2425import net.i2p.util.I2PAppThread;
    2526
     
    107108                                        if (tell) {
    108109                                                // tell who is connecting
    109                                                 out.write(I2P.getPeerDestination().toBase64().getBytes());
     110                                                out.write(DataHelper.getASCII(I2P.getPeerDestination().toBase64()));
    110111                                                out.write(10); // nl
    111112                                                out.flush(); // not really needed, but...
  • apps/admin/java/src/net/i2p/router/admin/AdminRunner.java

    r2246e21 rb6bd497  
    1212
    1313import net.i2p.data.Hash;
     14import net.i2p.data.DataHelper
    1415import net.i2p.router.Router;
    1516import net.i2p.router.RouterContext;
     
    4849        } else if ( (command.indexOf("routerStats.html") >= 0) || (command.indexOf("oldstats.jsp") >= 0) ) {
    4950            try {
    50                 out.write("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n".getBytes());
     51                out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n"));
    5152                _generator.generateStatsPage(new OutputStreamWriter(out));
    5253                out.close();
     
    6263        } else if (true || command.indexOf("routerConsole.html") > 0) {
    6364            try {
    64                 out.write("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n".getBytes());
     65                out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n"));
    6566                _context.router().renderStatusHTML(new OutputStreamWriter(out));
    6667                out.close();
     
    8182        reply.append(content);
    8283        try {
    83             out.write(reply.toString().getBytes());
     84            out.write(DataHelper.getASCII(reply.toString()));
    8485            out.close();
    8586        } catch (IOException ioe) {
     
    9899        reply.append(content);
    99100        try {
    100             out.write(reply.toString().getBytes());
     101            out.write(DataHelper.getASCII(reply.toString()));
    101102            out.close();
    102103        } catch (IOException ioe) {
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java

    r2246e21 rb6bd497  
    241241                        if (user != null && pw != null) {
    242242                            newRequest.append("Proxy-Authorization: Basic ")
    243                                       .append(Base64.encode((user + ':' + pw).getBytes(), true))    // true = use standard alphabet
     243                                      .append(Base64.encode(DataHelper.getUTF8(user + ':' + pw), true))    // true = use standard alphabet
    244244                                      .append("\r\n");
    245245                        }
     
    266266                        _log.warn(getPrefix(requestId) + "Auth required, sending 407");
    267267                }
    268                 out.write(getAuthError(result == AuthResult.AUTH_STALE).getBytes());
     268                out.write(DataHelper.getASCII(getAuthError(result == AuthResult.AUTH_STALE)));
    269269                s.close();
    270270                return;
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java

    r2246e21 rb6bd497  
    456456                t = new CompressedRequestor(s, socket, modifiedHeader, getTunnel().getContext(), _log);
    457457            } else {
    458                 t = new I2PTunnelRunner(s, socket, slock, null, modifiedHeader.getBytes(),
     458                t = new I2PTunnelRunner(s, socket, slock, null, DataHelper.getUTF8(modifiedHeader),
    459459                                               null, (I2PTunnelRunner.FailCallback) null);
    460460            }
     
    538538                if (_log.shouldLog(Log.INFO))
    539539                    _log.info("request headers: " + _headers);
    540                 serverout.write(_headers.getBytes());
     540                serverout.write(DataHelper.getUTF8(_headers));
    541541                browserin = _browser.getInputStream();
    542542                // Don't spin off a thread for this except for POSTs
     
    576576                    SERVER_SKIPHEADERS, _ctx);
    577577                String modifiedHeaders = formatHeaders(headers, command);
    578                 compressedOut.write(modifiedHeaders.getBytes());
     578                compressedOut.write(DataHelper.getUTF8(modifiedHeaders));
    579579
    580580                Sender s = new Sender(compressedOut, serverin, "server: server to browser", _log);
     
    703703            //    _log.info("Including x-i2p-gzip as the content encoding in the response");
    704704            if (shouldCompress())
    705                 out.write("Content-encoding: x-i2p-gzip\r\n".getBytes());
     705                out.write(DataHelper.getASCII("Content-encoding: x-i2p-gzip\r\n"));
    706706            super.finishHeaders();
    707707        }
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java

    r2246e21 rb6bd497  
    130130            tunnel.getContext().random().nextBytes(this.cloakKey);
    131131        } else {
    132             this.cloakKey = SHA256Generator.getInstance().calculateHash(passphrase.trim().getBytes()).getData();
     132            this.cloakKey = SHA256Generator.getInstance().calculateHash(DataHelper.getUTF8(passphrase.trim())).getData();
    133133        }
    134134       
     
    160160            }
    161161            Socket s = getSocket(socket.getPeerDestination().calculateHash(), socket.getLocalPort());
    162             Thread t = new I2PTunnelRunner(s, socket, slock, null, modifiedRegistration.getBytes(),
     162            Thread t = new I2PTunnelRunner(s, socket, slock, null, DataHelper.getUTF8(modifiedRegistration),
    163163                                           null, (I2PTunnelRunner.FailCallback) null);
    164164            // run in the unlimited client pool
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSHeader.java

    r2246e21 rb6bd497  
    5656        System.arraycopy(this.header, 0, beg, 0, beg.length);
    5757        String b32 = dest.toBase32();
    58         System.arraycopy(this.header, beg.length, b32.getBytes(), 0, 60);
     58        System.arraycopy(this.header, beg.length, DataHelper.getASCII(b32), 0, 60);
    5959        System.arraycopy(this.header, beg.length + 60, end, 0, end.length);
    6060    }
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSServerFactory.java

    r2246e21 rb6bd497  
    1313import java.util.Properties;
    1414
     15import net.i2p.data.DataHelper;
    1516import net.i2p.i2ptunnel.I2PTunnelHTTPClientBase;
    1617
     
    6465            case 'P':
    6566                DataOutputStream out = new DataOutputStream(s.getOutputStream());
    66                 out.write(ERR_REQUEST_DENIED.getBytes());
     67                out.write(DataHelper.getASCII(ERR_REQUEST_DENIED));
    6768                throw new SOCKSException("HTTP request to socks");
    6869            default:
  • apps/ministreaming/java/demo/net/i2p/client/streaming/StreamSinkServer.java

    r2246e21 rb6bd497  
    1212import net.i2p.I2PException;
    1313import net.i2p.data.DataFormatException;
     14import net.i2p.data.DataHelper;
    1415import net.i2p.data.Destination;
    1516import net.i2p.util.I2PThread;
     
    142143                        _log.debug("read and wrote " + read + " (" + written + ")");
    143144                }
    144                 fos.write(("written: [" + written + "]\n").getBytes());
     145                fos.write((DataHelper.getUTF8("written: [" + written + "]\n")));
    145146                long lifetime = System.currentTimeMillis() - start;
    146147                _log.info("Got EOF from client socket [written=" + written + " lifetime=" + lifetime + "]");
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHandler.java

    r2246e21 rb6bd497  
    5656            Properties props = new Properties();
    5757            try {
    58                 DataHelper.loadProps(props, new ByteArrayInputStream(_config.getBytes()));
     58                DataHelper.loadProps(props, new ByteArrayInputStream(DataHelper.getUTF8(_config)));
    5959            } catch (IOException ioe) {
    6060                _log.error("Config error", ioe);
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHandler.java

    r2246e21 rb6bd497  
    55import java.util.Properties;
    66
     7import net.i2p.data.DataHelper;
    78import net.i2p.util.LogManager;
    89
     
    7778                Properties props = new Properties();
    7879                if (_levels != null)
    79                     props.load(new ByteArrayInputStream(_levels.getBytes()));
     80                    props.load(new ByteArrayInputStream(DataHelper.getUTF8(_levels)));
    8081                if (_newLogClass != null)
    8182                    props.setProperty(_newLogClass, _newLogLevel);
  • apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java

    r2246e21 rb6bd497  
    1212import java.util.concurrent.Semaphore;
    1313
     14import net.i2p.data.DataHelper;
    1415import net.i2p.router.RouterContext;
    1516import net.i2p.stat.Rate;
     
    260261            if (lsnr.getRate().equals(rate)) {
    261262                lsnr.getData().exportXml(out);
    262                 out.write(("<!-- Rate: " + lsnr.getRate().getRateStat().getName() + " for period " + lsnr.getRate().getPeriod() + " -->\n").getBytes());
    263                 out.write(("<!-- Average data source name: " + lsnr.getName() + " event count data source name: " + lsnr.getEventName() + " -->\n").getBytes());
     263                out.write(DataHelper.getUTF8("<!-- Rate: " + lsnr.getRate().getRateStat().getName() + " for period " + lsnr.getRate().getPeriod() + " -->\n"));
     264                out.write(DataHelper.getUTF8("<!-- Average data source name: " + lsnr.getName() + " event count data source name: " + lsnr.getEventName() + " -->\n"));
    264265                return true;
    265266            }
  • apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java

    r2246e21 rb6bd497  
    4141            Socket s = new Socket(host, port);
    4242            OutputStream out = s.getOutputStream();
    43             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     43            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    4444            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    4545            String line = reader.readLine();
    4646            _log.debug("line read for valid version: " + line);
    4747            String req = "SESSION CREATE STYLE=DATAGRAM DESTINATION=" + destName + " " + conOptions + "\n";
    48             out.write(req.getBytes());
     48            out.write(DataHelper.getASCII(req));
    4949            line = reader.readLine();
    5050            _log.info("Response to creating the session with destination " + destName + ": " + line);
  • apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java

    r2246e21 rb6bd497  
    5757            Socket s = new Socket(host, port);
    5858            OutputStream out = s.getOutputStream();
    59             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     59            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    6060            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    6161            String line = reader.readLine();
    6262            //_log.debug("line read for valid version: " + line);
    6363            String req = "SESSION CREATE STYLE=RAW DESTINATION=" + destName + " " + conOptions + "\n";
    64             out.write(req.getBytes());
     64            out.write(DataHelper.getASCII(req));
    6565            line = reader.readLine();
    6666            _log.info("Response to creating the session with destination " + destName + ": " + line);
  • apps/sam/java/test/net/i2p/sam/TestCreateSessionStream.java

    r2246e21 rb6bd497  
    66import java.net.Socket;
    77
     8import net.i2p.data.DataHelper;
    89import net.i2p.util.Log;
    910
     
    4142            Socket s = new Socket(host, port);
    4243            OutputStream out = s.getOutputStream();
    43             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     44            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    4445            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    4546            String line = reader.readLine();
    4647            _log.debug("line read for valid version: " + line);
    4748            String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + destName + " " + conOptions + "\n";
    48             out.write(req.getBytes());
     49            out.write(DataHelper.getASCII(req));
    4950            line = reader.readLine();
    5051            _log.info("Response to creating the session with destination " + destName + ": " + line);
  • apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java

    r2246e21 rb6bd497  
    88import java.util.StringTokenizer;
    99
     10import net.i2p.data.DataHelper;
    1011import net.i2p.util.Log;
    1112
     
    2324            Socket s = new Socket(host, port);
    2425            OutputStream out = s.getOutputStream();
    25             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     26            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    2627            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    2728            String line = reader.readLine();
    2829            _log.debug("line read for valid version: " + line);
    2930            String req = "SESSION CREATE STYLE=DATAGRAM DESTINATION=" + destName + " " + conOptions + "\n";
    30             out.write(req.getBytes());
     31            out.write(DataHelper.getASCII(req));
    3132            line = reader.readLine();
    3233            _log.info("Response to creating the session with destination " + destName + ": " + line);
    3334            _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
    3435            String lookup = "NAMING LOOKUP NAME=ME\n";
    35             out.write(lookup.getBytes());
     36            out.write(DataHelper.getASCII(lookup));
    3637            line = reader.readLine();
    3738            _log.info("Response from the lookup for ME: " + line);
     
    5152           
    5253            String send = "DATAGRAM SEND DESTINATION=" + value + " SIZE=3\nYo!";
    53             out.write(send.getBytes());
     54            out.write(DataHelper.getASCII(send));
    5455            line = reader.readLine();
    5556            tok = new StringTokenizer(line);
  • apps/sam/java/test/net/i2p/sam/TestDest.java

    r2246e21 rb6bd497  
    2020            Socket s = new Socket(host, port);
    2121            OutputStream out = s.getOutputStream();
    22             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     22            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    2323            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    2424            String line = reader.readLine();
    2525            _log.debug("line read for valid version: " + line);
    2626            String req = "SESSION CREATE STYLE=STREAM DESTINATION=testNaming " + conOptions + "\n";
    27             out.write(req.getBytes());
     27            out.write(DataHelper.getASCII(req));
    2828            line = reader.readLine();
    2929            _log.debug("Response to creating the session with destination testNaming: " + line);
    3030            _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
    3131            String lookup = "DEST GENERATE\n";
    32             out.write(lookup.getBytes());
     32            out.write(DataHelper.getASCII(lookup));
    3333            line = reader.readLine();
    3434            _log.info("Response from the dest generate: " + line);
  • apps/sam/java/test/net/i2p/sam/TestHello.java

    r2246e21 rb6bd497  
    66import java.net.Socket;
    77
     8import net.i2p.data.DataHelper;
    89import net.i2p.util.Log;
    910
     
    2223            Socket s = new Socket(host, port);
    2324            OutputStream out = s.getOutputStream();
    24             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     25            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    2526            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    2627            String line = reader.readLine();
     
    3738            Socket s = new Socket(host, port);
    3839            OutputStream out = s.getOutputStream();
    39             out.write("HELLO VERSION MIN=9.0 MAX=8.3\n".getBytes());
     40            out.write(DataHelper.getASCII("HELLO VERSION MIN=9.0 MAX=8.3\n"));
    4041            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    4142            String line = reader.readLine();
     
    5253            Socket s = new Socket(host, port);
    5354            OutputStream out = s.getOutputStream();
    54             out.write("HELLO h0 h0 h0\n".getBytes());
     55            out.write(DataHelper.getASCII("HELLO h0 h0 h0\n"));
    5556            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    5657            String line = reader.readLine();
  • apps/sam/java/test/net/i2p/sam/TestNaming.java

    r2246e21 rb6bd497  
    4040            Socket s = new Socket(host, port);
    4141            OutputStream out = s.getOutputStream();
    42             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     42            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    4343            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    4444            String line = reader.readLine();
    4545            _log.debug("line read for valid version: " + line);
    4646            String req = "SESSION CREATE STYLE=STREAM DESTINATION=testNaming " + conOptions + "\n";
    47             out.write(req.getBytes());
     47            out.write(DataHelper.getASCII(req));
    4848            line = reader.readLine();
    4949            _log.debug("Response to creating the session with destination testNaming: " + line);
    5050            _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
    5151            String lookup = "NAMING LOOKUP NAME=" + name + "\n";
    52             out.write(lookup.getBytes());
     52            out.write(DataHelper.getASCII(lookup));
    5353            line = reader.readLine();
    5454            _log.info("Response from the lookup for [" + name +"]: " + line);
  • apps/sam/java/test/net/i2p/sam/TestRawTransfer.java

    r2246e21 rb6bd497  
    2323            Socket s = new Socket(host, port);
    2424            OutputStream out = s.getOutputStream();
    25             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     25            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    2626            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    2727            String line = reader.readLine();
    2828            _log.debug("line read for valid version: " + line);
    2929            String req = "SESSION CREATE STYLE=RAW DESTINATION=" + destName + " " + conOptions + "\n";
    30             out.write(req.getBytes());
     30            out.write(DataHelper.getASCII(req));
    3131            line = reader.readLine();
    3232            _log.info("Response to creating the session with destination " + destName + ": " + line);
    3333            _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
    3434            String lookup = "NAMING LOOKUP NAME=ME\n";
    35             out.write(lookup.getBytes());
     35            out.write(DataHelper.getASCII(lookup));
    3636            line = reader.readLine();
    3737            _log.info("Response from the lookup for ME: " + line);
     
    5151           
    5252            String send = "RAW SEND DESTINATION=" + value + " SIZE=3\nYo!";
    53             out.write(send.getBytes());
     53            out.write(DataHelper.getASCII(send));
    5454            line = reader.readLine();
    5555            try {
  • apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java

    r2246e21 rb6bd497  
    1212import java.util.StringTokenizer;
    1313
     14import net.i2p.data.DataHelper;
    1415import net.i2p.util.I2PThread;
    1516import net.i2p.util.Log;
     
    6364            Socket s = new Socket(host, port);
    6465            OutputStream out = s.getOutputStream();
    65             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     66            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    6667            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    6768            String line = reader.readLine();
    6869            _log.debug("line read for valid version: " + line);
    6970            String req = "SESSION CREATE STYLE=STREAM DESTINATION=Alice " + conOptions + "\n";
    70             out.write(req.getBytes());
     71            out.write(DataHelper.getASCII(req));
    7172            line = reader.readLine();
    7273            _log.info("Response to creating the session with destination Alice: " + line);
    7374           
    7475            req = "NAMING LOOKUP NAME=ME\n";
    75             out.write(req.getBytes());
     76            out.write(DataHelper.getASCII(req));
    7677            line = reader.readLine();
    7778            StringTokenizer tok = new StringTokenizer(line);
     
    213214            Socket s = new Socket(host, port);
    214215            OutputStream out = s.getOutputStream();
    215             out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     216            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    216217            BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
    217218            String line = reader.readLine();
    218219            _log.debug("line read for valid version: " + line);
    219220            String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + sessionName + " " + conOptions + "\n";
    220             out.write(req.getBytes());
     221            out.write(DataHelper.getASCII(req));
    221222            line = reader.readLine();
    222223            _log.info("Response to creating the session with destination "+ sessionName+": " + line);
    223224            req = "STREAM CONNECT ID=42 DESTINATION=" + _alice + "\n";
    224             out.write(req.getBytes());
     225            out.write(DataHelper.getASCII(req));
    225226            line = reader.readLine();
    226227            _log.info("Response to the stream connect from "+sessionName+" to Alice: " + line);
     
    239240            req = "STREAM SEND ID=42 SIZE=10\nBlahBlah!!";
    240241            _log.info("\n** Sending BlahBlah!!");
    241             out.write(req.getBytes());
     242            out.write(DataHelper.getASCII(req));
    242243            out.flush();
    243244            try { Thread.sleep(5*1000) ; } catch (InterruptedException ie) {}
    244245            req = "STREAM SEND ID=42 SIZE=10\nFooBarBaz!";
    245246            _log.info("\n** Sending FooBarBaz!");
    246             out.write(req.getBytes());
     247            out.write(DataHelper.getASCII(req));
    247248            out.flush();
    248249            /* Don't delay here, so we can test whether all data is
     
    250251            _log.info("Sending close");
    251252            req = "STREAM CLOSE ID=42\n";
    252             out.write(req.getBytes());
     253            out.write(DataHelper.getASCII(req));
    253254            out.flush();
    254255            synchronized (_counterLock) {
  • apps/sam/java/test/net/i2p/sam/TestSwarm.java

    r2246e21 rb6bd497  
    141141        synchronized (_samOut) {
    142142            try {
    143                 _samOut.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
     143                _samOut.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
    144144                _samOut.flush();
    145145                _log.debug("Hello sent");
     
    149149                    throw new IOException("wtf, hello failed?");
    150150                String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + _destFile + " " + _conOptions + "\n";
    151                 _samOut.write(req.getBytes());
     151                _samOut.write(DataHelper.getUTF8(req));
    152152                _samOut.flush();
    153153                _log.debug("Session create sent");
     
    156156
    157157                req = "NAMING LOOKUP NAME=ME\n";
    158                 _samOut.write(req.getBytes());
     158                _samOut.write(DataHelper.getASCII(req));
    159159                _samOut.flush();
    160160                _log.debug("Naming lookup sent");
     
    178178        try {
    179179            FileOutputStream fos = new FileOutputStream(_destFile);
    180             fos.write(dest.getBytes());
     180            fos.write(DataHelper.getASCII(dest));
    181181            fos.close();
    182182            return true;
     
    204204                    }
    205205                   
    206                     byte msg[] = ("STREAM CONNECT ID=" + con + " DESTINATION=" + remDest + "\n").getBytes();
     206                    byte msg[] = (DataHelper.getUTF8("STREAM CONNECT ID=" + con + " DESTINATION=" + remDest + "\n"));
    207207                    synchronized (_samOut) {
    208208                        _samOut.write(msg);
     
    258258            long lastSend = _context.clock().now();
    259259            while (!_closed) {
    260                 byte msg[] = ("STREAM SEND ID=" + _connectionId + " SIZE=" + data.length + "\n").getBytes();
     260                byte msg[] = (DataHelper.getASCII("STREAM SEND ID=" + _connectionId + " SIZE=" + data.length + "\n"));
    261261                DataHelper.toLong(data, 0, 4, value);
    262262                try {
  • apps/streaming/java/test/junit/net/i2p/client/streaming/impl/EchoIT.java

    r2246e21 rb6bd497  
    1313import net.i2p.client.streaming.I2PServerSocket;
    1414import net.i2p.client.streaming.I2PSocketManager;
     15import net.i2p.data.DataHelper;
    1516import net.i2p.util.Log;
    1617
     
    117118                OutputStream out = socket.getOutputStream();
    118119                for (int i = 0; i < 3; i++) {
    119                     out.write("blah!".getBytes());
     120                    out.write(DataHelper.getASCII("blah!"));
    120121                    _log.debug("client wrote a line");
    121122                    out.flush();
Note: See TracChangeset for help on using the changeset viewer.