In front of the analysis of the 2 major package classes, now we have to uncover the java.nio of the last block of mysterious knowledge points, CharSet encoding class, his main function is to achieve the conversion between byte and Unicode transcoding. Let's also look at the structure of his package. , the structure is relatively single and simple.
One of the most important classes inside is the CharSet class to see what variables are inside.
His constructor functions as
The CharSet class also has the type of the cache byte itself
Let's take a look at his main function. How encode encoding is implemented
The method in which we know the code call is actually the Charsetencoder encode method, and then we look inside.
Then the core of the Encode method, the method is relatively long
Decode similar to this, do not introduce, below we look at which involves a coderresult result class
Well, there's one last provider class, in Charset.spi,
I don't seem to have seen it when I use it specifically. So Java.nio analysis to this end, I hope to bring you a harvest, but some places I am more difficult to understand
Analysis of Java.nio Package (iii) understanding of the---charset