how to post string data in byte format to server?
<p>I want to send a string data, "" , in bytes format to server in android app. I uses the HttpClient but i think its not the right way, please help me how to do this?</p>

<p>in case of .net , i want similar code in java.</p>

<pre><code>    string boundary = Guid.NewGuid().ToString();
    HttpWebRequest request = HttpWebRequest.Create(url)
        as HttpWebRequest;
    request.Method = "POST";
    //request.ContentType = "application/json";
    request.PreAuthenticate = true;

    byte[] fulldata = Encoding.UTF8.GetBytes(data);
    request.ContentLength = fulldata.Length;
    using (Stream sw = request.GetRequestStream())
    {
        sw.Write(fulldata, 0, fulldata.Length);
    }
</code></pre>
