List some of the differences I've learned
Java is InputStream (java.io.InputStream) and OutputStream (java.io.OutputStream http://docs.oracle.com/javase/jp/6/api/org/omg/CORBA/portable/OutputStream.html)) It is divided into two parts, input and output.
On the other hand, in the .NET Framework, it is called Stream (System.IO.Stream). As you can see, the input and output are unified.
But,
// C # sample code DeflateStream compressionStream = ne w DeflateStream(compressedFileStream, CompressionMode.Compress));
If you do, the output system (write) is good, but if you try to input (read), an error will occur, so it will hurt if you think that you can always input and output.
java is "-1" .NET Framework is "0". (Only readByte () method is "-1")
.NET Framework 4 and later CopyTo (distStream) methods are useful
In Java, there are classes of the concept of filter streams (java.io.FilterInputStream and java.io. FilterOutputStream), so make it by inheriting it
There is no such thing in the .NET Framework, it is created by inheriting Stream
Java is java.io.ByteArrayInputStream and java.io.ByteArrayOutputStream .oracle.com/javase/jp/6/api/java/io/ByteArrayOutputStream.html)
.NET Framework is System.IO.MemoryStream
Both Java / .NET Framework are difficult to use in situations where data is generated in real time → read () ends.
Java is java.io.PipedInputStream and java.io.PipedOutputStream .oracle.com/javase/jp/6/api/java/io/PipedOutputStream.html)
.NET Framework doesn't know such classes Suffice it to say, the anonymous pipe class (System.IO.Pipes.AnonymousPipeClientStream. aspx) and System.IO.Pipes.AnonymousPipeServerStream)
Java is fine
--Cryptography -javax.crypto.CipherInputStream and [javax.crypto.CipherOutputStream](http://docs. oracle.com/javase/jp/6/api/javax/crypto/CipherOutputStream.html) --The substance of them javax.crypto.Cipher --Hash -java.security.DigestInputStream and [java.security.DigestOutputStream](http://docs. oracle.com/javase/jp/6/api/java/security/DigestOutputStream.html) --The substance of them java.security.MessageDigest
Treated in a unified manner
Base class
System.Security.Cryptography.ICryptoTransform Assigned to the above class as an interface
--Cryptography -CreateEncryptor / CreateDecryptor method of System.Security.Cryptography.SymmetricAlgorithm --Hash --[System.Security.Cryptography.HashAlgorithm] inherited from ICryptoTransform [https://msdn.microsoft.com/ja-jp/library/system.security.cryptography.hashalgorithm(v=vs.110).aspx)
HMAC under HashAlgorithm
There is.
Both Java / .NET Framework did not have the function to compress in real time, but from Java7 [java.util.zip.Deflater#SYNC_FLUSH](http://docs.oracle.com/javase/jp/8/docs/api/ java / util / zip / Deflater.html) has been added to enable real-time zlib compression.
For the .NET Framework, you can use zlib.NET.dll. How to perform compression synchronously (real time) with C # /.NET Framework
SSL
Java inherits java.net.Socket javax.net.ssl.SSLSocket //docs.oracle.com/javase/jp/6/api/javax/net/ssl/SSLSocket.html)
.NET Framework inherits System.IO.Stream System.Net .Security.SslStream
The .NET Framework inherits Stream, while Java branches into InputStream / OutputStream !? Socket inherits
Java is versatile
--Protocol / cipher suites supported as JavaVM
.NET Framework only protocol control !?
Reader/Writer
Both Java / .NET Framework are unified with internal character code UTF16.
Java is basically prepared for each implementation AudioFileReader, FileReader, FilterReader, InputStreamReader, LineNumberReader, PipedReader, PushbackReader, Reader, XMLStreamReader .... too many
The .NET Framework includes System.IO.StreamReader and System.IO. StreamWriter
System.IO.StreamReader.ReadToEnd () is convenient.
Close to ReadAll () for file operations in VisualBASIC6.0 (Scripting.FileSystemObject). Very convenient.
Multicast is implemented as UDP in both .NET Framework / Java
Java inherits java.net.DatagramSocket which is the substance of UDP [java.net.MulticastSocket] ](Http://docs.oracle.com/javase/jp/6/api/java/net/MulticastSocket.html)
The .NET Framework is the entity of UDP [System.Net.Sockets.UdpClient](https://msdn.microsoft.com/ja-jp/library/system.net.sockets.udpclient (v = vs.110). aspx) itself
In Java, it is javax.sound.sampled.AudioInputStream that inherits Stream, so recording is easy. it can.
The output (audio playback to the speaker) is not Stream, but you can easily create a wrapper that inherits Stream.
The .NET Framework can only use Managed DirectX (MDX) or 3rd Party's SlimDX, but coding may be quite difficult.
Web(HttpClient)
Java inherits java.net.URLConnection [java.net.HttpURLConnection](http: / /docs.oracle.com/javase/jp/6/api/java/net/HttpURLConnection.html) "http only" and its children javax.net.ssl.HttpsURLConnection /javase/jp/6/api/javax/net/ssl/HttpsURLConnection.html) "For https"
.NET Framework inherits System.Net.WebRequest System.Net .HttpWebRequest "http / https combined use"
Android has org.apache.http.client.HttpClient class
Java is basic such as int, long (only necessary and sufficient)
.NET Framework is various such as Int32, UInt32 ,,,
Java is -128 to 127 (Be careful when converting to and from JRuby / Jython)
.NET Framework 0-255
Personally, I don't understand the meaning of negative numbers in byte type.
Java can put static methods in instantiated objects → You can call it with this
.NET Framework cannot be called with this
Java calls the class itself java.lang.Thread class (java.lang.Runnable //docs.oracle.com/javase/jp/6/api/java/lang/Runnable.html) Inherit and implement the interface) → Threads can be said to be class units
.NET Framework registers the method in System.Threading.Thread → Threads can be said to be method units
Java lock is "synchronized"
Various .NET Framework locks (with the evolution of Windows ...)
Base64
Java.util.Base64 from JDK8
.NET Framework Base64 in many places
Java URL encoding (java.net.URLEncoder and [java.net.URLDecoder](http: //docs.oracle.com/javase/jp/6/api/java/net/URLDecoder.html)) is a character string → Cannot be used
Java string comparison is equals () method
You cannot switch () with a string in Java. → Solved with Java 8 !?
How to perform compression synchronously (real time) with C # /.NET Framework
Java is [javax.xml.parsers.DocumentBuilder # setEntityResolver () method](https://docs.oracle.com/javase/jp/6/api/javax/xml/parsers/DocumentBuilder.html#setEntityResolver (org.xml) .sax.EntityResolver)))
.NET Framework is System.Xml.XmlDocument # XmlResolver Property
Not only are the above methods and properties different, but the behavior when NULL is specified is also different.
Java adopts the default object (that is, the same as parsing XML without calling a method).
The .NET Framework is a NULL object (that is, no xrefs / no xrefs).
The object that specifies the resolver of the above xref is
For Java, org.xml.sax.EntityResolver interface
For .NET Framework, System.Xml.XmlResolver abstract class
Obviously, the only thing that needs to be implemented in the object that specifies the xref resolver above is ** "a method that returns the content of the URI that points to the xref" **.
For Java, [org.xml.sax.InputSource.InputSource resolveEntity (String publicId, String systemId) method](https://docs.oracle.com/javase/jp/6/api/org/xml/sax/EntityResolver .html # resolveEntity (java.lang.String,% 20java.lang.String))
The second argument is a String type, but a URI indicating an external reference comes and [org.xml.sax.InputSource.InputSource class](https://docs.oracle.com/javase/jp/6/api/org/xml /sax/InputSource.html) is returned.
For .NET Framework, [object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn) method](https://docs.microsoft.com/ja-jp/dotnet/api/system.xml.xmlresolver.getentity?view= netframework-4.7.2 # System_Xml_XmlResolver_GetEntity_System_Uri_System_String_System_Type_) only.
In the first argument, the URI indicating the external reference comes in System.Uri class. , System.IO.Stream class is just returned.
There is a third argument that indicates the type / class you want to return, but the reality is [System.IO.Stream class](https://docs.microsoft.com/ja-jp/dotnet/api/system.io.stream? It seems that only view = netframework-4.7.2) is given, so after all [System.IO.Stream class](https://docs.microsoft.com/ja-jp/dotnet/api/system.io.stream?view?view Just return = netframework-4.7.2).
For the above .NET FrameWork, use System.IO.Stream class It's neat because it just returns, but the [org.xml.sax.InputSource.InputSource class] for Java (https://docs.oracle.com/javase/jp/6/api/org/xml/sax) What is /InputSource.html)? java.io.InputStream class and [java.io.Reader class](https://docs .oracle.com/javase/jp/6/api/java/io/Reader.html) (and the character code) can be expressed as a summary.
For Java, there's usually something in Apache-Commons
.NET Framework ... I don't know
Classless.Hasher was convenient
Rei no Hut C # Random Library was convenient
The Legion of the Bouncy Castle may be a classic crypto library for both Java / .NET Framework