Package com.client0601;
Import Java.nio.charset.Charset;
public class App {
public static void Main (string[] args) {
For (String key:Charset.availableCharsets (). KeySet ()) {
SYSTEM.OUT.PRINTLN (key);
}
System.out.println (Charset.defaultcharset ());
}
}
Buffer byte stream:
Object-->outputstream-->fileteroutputstream-->bufferedoutputstream
Use of decorative mode
Buffered input stream
Object-->inputstream-->fileterinputstream-->bufferedinputstream
Close ()
Frees the system resources associated with it, multiple shutdowns without impact, no error. Close from outside to inside.
byte array output stream: Bytearrayoutputstream
Object-->outputstream-->bytearrayoutputstream
Open up space in memory and store data. Not a buffer stream
Create it directly and use it to
byte array input stream: Bytearrayinputstream
Object-->inputstream-->bytearrayinputstream
Conversion between Intt and byte[].
InputStreamReader Conversion Stream
Object-->reader-->inputstreamreader
InputStreamReader is not a buffer stream
When using, try to use BufferedReader to pack and improve the efficiency.
Package com.client0602;
Import Java.io.BufferedReader;
Import Java.io.FileOutputStream;
Import Java.io.InputStreamReader;
Import Java.io.PrintStream;
public class Standeriodemo {
public static void Main (string[] args) throws Exception {
BufferedReader br=new BufferedReader (New InputStreamReader (system.in));
System.setout (New PrintStream (New FileOutputStream ("E:/e.txt") {
}));
System.out.println ("Hello word");
String line= "";
while ((Line=br.readline ())!=null) {
if (Line.equals ("Exit")) {
System.exit (-1);
}else{
System.out.println (line);
}
}
Br.close ();
}
}
Describes the IO stream. And the function of the flow.
Input output stream character byte stream, buffered and non-buffered streams.
Bridge stream or transform stream.
Modifies the default output method. Pass in a new print object,
The Print object has overloads of a number of constructors.
File
Directory:
Path: The address of the precise Dingzhun file.
File F=new file ("E:/e.txt");
System.out.println (F.exists ());
String Abspath=f.getabsolutepath ();
String Name=f.getname ();
String Cadfad=f.getcanonicalpath ();
String parent=f.getparent ();
Absolute path
System.out.println (". GetAbsolutePath ():" +abspath);
File name, not copy directory
System.out.println ("F.getname ():" +name);
Get the normal path without (. |.)
System.out.println ("F.getcanonicalpath ():" +CADFAD);
Get the destination of the file
System.out.println ("F.getparent ():" +parent);
Java Foundation 14th Day Summary