Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8822553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:08:06+00:00 2026-06-14T06:08:06+00:00

Problem How to send UTF-8 data between the server and the client, if I

  • 0

Problem

How to send UTF-8 data between the server and the client, if I can use on client only

inputStream.read()

?

Docs

Reads a single byte from this stream and returns it as an integer in
the range from 0 to 255. Returns -1 if the end of the stream has been
reached.

Without reader.readLine() and any another. (With reader I cant see end of stream)

Help please!

(full code:)

int c;
String str = new String();
while ((c = inputStream.read( )) != -1)
{
    char ch = (char)c;
    if(ch == '\n')
    {
        Log.v("", str);
        final String data = str;

        runOnUiThread(new Runnable()
        {
            @Override
            public void run()
            {
                String put[] = data.split("#");
                try
                {
                    //cmd parsing
                }
                catch(Exception e)
                {
                    //stop connection
                }
            }
        });
        str = "";
    }else{
        str += Character.toString(ch);
    }
}
//Communication error

Help please

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:08:08+00:00Added an answer on June 14, 2026 at 6:08 am

    You might want to take a look at this previous post. There’s a couple of good options on there. The read() method can be overloaded with different parameters, so you can read one byte, or n bytes. Check out the full documentation here. Basically, you’ll have to read in the raw bytes, then convert them to ASCII characters. Also, I’m curious as to why you can’t use BufferedReader or an equivalent class?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is to send a structure between a program in C to a
I've a problem. I try to send a JSON request to a web server
Here is my code of Qt creator to send the data to PHP server
I'm trying to use a JavaScript library to encrypt data and send that to
Problem I read first byte in my socket client to check connection: ByteBuffer b
I use the following code to send request to the server: HttpClient httpclient =
I am working on android chat application. I am facing a problem in send
I'm a beginner concerning socket programming and I have a problem when I send
I have a problem when trying to send a POST request. The sending method
I have the following problem, from c++ I send huge string[] to java. huge

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.