-
while((len=!=-1) Here will get the data entered by the keyboard, it is a blocking method, len will return the maximum data byte value, if the loop is no data, it will return -1, you enter does not mean that the data is over, you enter is actually it''''This means that the data has not been fetched, and the loop will continue, and then it will go to the read() method, and continue to enter, and if you want to end, you must define the end mark.
string value = new string(buf,0,len);
if("over".equals(value)) ends if you enter over.
break;
If you want to enter it once, you don't need to judge, just add break to the last hop statement of the while loop;
while((len=!=-1)
string(buf,0,len));
break;
-
Because your cycle end condition has always been true.
-
If you don't type anything, you will get len =2;yes, so len <=2 means nothing was entered. There may be a problem with this source code.
-
There are two bytes per character, so if you < 2, you don't have it at all.
-
public class test
You set the size of the byte array based on the size of the string you want to enter.
-
Public int read(byte b) is a method of reading up to bytes of data from this input stream into a byte array.
That is, when it returns -1, the data has been copied, and the while loop terminates the program.
-
This is to read the number in a file and store it in bytes, and then assign a value to len for each bytes separately. If there is still a value, then len is not equal to -1, and the reading will continue in a loop until the value is read.
-
The number of bytes is returned, and a Chinese character is two bytes.
-
is the number of bytes returned, and it is also a Chinese character that accounts for two bytes. What question would you like to ask?
Song Title: The Earth Is Weeping.
Singer: Liu Genghong. >>>More
Beethoven, a world-famous ** artist, finally composed a symphony after going through many tribulations.
The lingering song spread throughout the carriage and through the windows to every corner of the world, the flower of friendship bloomed in the hearts of every listener, and the whole world became quiet and serene, without the noise and irritability of the past, only a beautiful sound, which made the white clouds stop floating, Birdchester stepped on the train to Connecticut, and at this moment his mind suddenly flashed to the picture of living with Tucker, Mario and Harry, how happy they were, Mario smiled and sold newspapers to every customer, Tucker lay on Harry's back, Harry's tail swaying comfortably, and they ate crumbled bread and drank Coke, looking like they were enjoying themselves, while Chester listened to the recording, closed his eyes and wandered in ......the ocean of human beingsYes, Chester began to regret it, but it also longed for a free life in the country, and when the train started, even regretting it would not help. Chester was surprised to see Mario, Tucker, and Harry out the window, and they waved to Chester, who, like them, had tears in his eyes. >>>More
There is a saying that people will see people's hearts over time. >>>More
Loosen the soil and decompose some organic matter.