What is the Android/Java corresponding method to the C# Stream object method Write()? -


a snippet of code want translate here:

class mk     {            stream connection;         tcpclient con;          public mk(string ip)         {             con = new tcpclient();             con.connect(ip, 8728);             connection = (stream)con.getstream();         }         public void close()         {             connection.close();             con.close();         }         public bool login(string username, string password)         {             send("/login", true);             string hash = read()[0].split(new string[] { "ret=" }, stringsplitoptions.none)[1];             send("/login");             send("=name=" + username);             send("=response=00" + encodepassword(password, hash), true);             if (read()[0] == "!done")             {                 return true;             }             else             {                 return false;             }         }         public void send(string co)         {             byte[] bajty = encoding.ascii.getbytes(co.tochararray());             byte[] velikost = encodelength(bajty.length);              connection.write(velikost, 0, velikost.length);             connection.write(bajty, 0, bajty.length);         }         public void send(string co, bool endsentence)         {             byte[] bajty = encoding.ascii.getbytes(co.tochararray());             byte[] velikost = encodelength(bajty.length);             connection.write(velikost, 0, velikost.length);             connection.write(bajty, 0, bajty.length);             connection.writebyte(0);         } 

the equivalent of stream.write outputstream.write... it's not clear whether enough you. (it's not clear why current code using encoding.ascii.getbytes(co.tochararray()) instead of encoding.ascii.getbytes(co)


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -