Before writing, I declare that I am very dish and lazy.
Let's take a look at the cause.
I want to pass a file to C # Through Java through the network. Because I am very lazy, I chose web service and only wanted to pass the simple type, so I remembered base64, so I decided to use base64 encoding to provide web services through Java, called by C.
You must first compile the base64 code. If you do not compile it in Java, You must select C # encoding. You must save the code as a text file and use Java to read and compare it. Then, you can read the text file.
C #:
Streamreader reader = file. opentext ("C: // data.txt ");
This. Buffer = reader. readtoend ();
Java:
Bufferedreader reader = new bufferedreader (New filereader ("C: // data.txt "));
Return reader. Readline ();
I am so depressed ,. net, while Java can only read one row. net, the idea is very clear, to read files, must file, what to do? File. open ..., ah, I found opentext In the IDE prompt. This is what I want. Bless me as a string file name... bingo... I guessed it. I was excited to add the file name, and the file exists. opentext ("C: // data.txt"), which is written in this way at the beginning. This. buffer = file. opentext ("C: // data.txt "). readtoend (); because I clicked ide again and gave me a prompt, I found readtoend (), and later I wanted reader. close (), so the separation is also a matter of course, with vs programming, just like talking to it.
In Java, It is very depressing. Reader cannot read all but Readline. I am very confused. So I opened the help for JB, and searched for readall with Java API. What is the result? image. nothing, let alone how to use Java to encode base64.
I don't want to comment on who is doing well. Maybe I am too lazy, and I like C # a bit.
In addition, when using C # to read the text, it is easy to read, and the reader of Java. readline (), actually let my JB stop responding. Haha, maybe I really don't blame java. This line is too long, so long as 2 M: O.