Very interesting comparison, java with c #.

zhaozj2021-02-16  127

Before writing, first declare, I am delicious, it is very lazy.

There is a cause, first look at the reason.

I want to pass a file from Java to c #, because I am very lazy, I chose the web service, but I only want to pass the simple type, so I remembered Base64, so I decided to use the base64 encoded and provided Web Service through Java. , Call from C #.

You must first comply into the Base64 code, you will not edit it with Java, choose C # encoding, save into a text file, read it with Java, compare it, you will be read from 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 was really depressed, and I can read all in .NET, Java can only read a line, thinking in .NET is clear, read files, definitely want file, what? File.open ..., ah, I found OpenText from the pri of Ide, this is what I want, bless me is a string of file name ... Bingo ... I guess it is excited to add There is file name and file name, I have File.opentext ("c: //data.txt"), I started, this.buffer = file.opentext ("c: //data.txt"). Readtoend (); Because I gave me another note, I gave me a prompt, I found ReadToend (), and later I want reader.close (), so separated, this is also a matter of chapter, using the VS program, Like a conversation with it.

Java is very depressed, Reader is not readline, I am very fascinated, so I open help JB help, take the Java API, find Readall, what is image. What is the meaning, I don't have to say how to use Java? Encoded Base64.

I don't want to comment. Who is bad, maybe I am too lazy, I like it to C #.

Also added, when using C # read text, it is easy to read, and Java's reader.readline () actually let my JB stop responding, huh, maybe I really don't blame Java, I am. Too long, 2M is so long: o.

转载请注明原文地址:https://www.9cbs.com/read-8523.html

New Post(0)