JAVA in the flow - Introduction (II)

Standard flow

Class Name: System.in

Reads the user input interface class content, used in conjunction with a scanner before use

use:

 InputStream is = System.in
 byte [] bs = new byte[1024];
 while(n = is.read(bs)!=-1){
     String s= new String(bs,0,n);
 }
 // 1. Read Enter \ R & lt \ n-
  // 2. Analyzing the extracted input through (necessary to remove head and tail and white characters), to end manually break;
  // 3 byte elements can only be read in the console
  / / 4. If the internal standard stream, no matter how much flow filtration, require a manual end

Acquisition Flow

format:

ISR = the InputStreamReader new new the InputStreamReader ( "target byte stream" );
  // character stream inherited commutations

Processing Flow - target stream - the output stream

OOS = ObjectOutputStream new new ObjectOutputStream ();
  // 1. object must be passed in the serialization, implement the interface Serializable, and given sequence
  // file extension 2. Recommended storage .bat
  // 3. () is OutputStream interface implementation class

method:

 .writeObject (\ object class);

Processing Flow - target stream - the input stream

Class Name: ObjectInputStream / usage is similar to using the same output stream

method:

.readObject ();
  // 1. Object returns the object is a type
  // 2. need coerced to the type of storage

properties / properties file

Storage: key = value (similar to the HashMap)

method:

.load (\ input stream);
  // associated with the corresponding properties file 
.getproperty (\ key name);
  // read the value corresponding to the key name 
.stringPropertyNames ();
  // get all of the keys, the return type Set < String>

 

Special usage:

System.getProperty path = String ( "user.dir" );
  // get the parent absolute path of the current project
  // This is what we can to the directory that the file was created under the project
  // path + File.separator (equivalent to \\ file separator) + \ file name and extension 
 properties PP = System.getProperties ();
  // get the properties file in the project file 
pp.list (the System.out);
  // display file All content

other

  1. Constructors stream brackets ( "address", boolean value);

    false / cover (default)

    true / not covered, then write

  1. Basic data types and the package type

    name significance
    Packing Basic data types -> package type
    Unboxing Packaging category -> basic data types

    Note: If the package classes == determination, if the data value range class are encapsulated byte ranges, the determination is automatically unpacking in

  1. It is written to the stream: when the output stream is instantiated successfully, if no write true, then the corresponding empty class receiving path file

  2. Jar 包

    1. class file compression file

    1. Suffix .jar

    2. use

      1. Copy the file to the project

      2. Click .jar files -> Right -> Build path -> Add to Build path

  3. Generates a text file

    Export -> javadoc

    step

    Exprot->java->javadoc

    // The first time you export, you need to select jdk-> bin-> javadoc.exe

Guess you like

Origin www.cnblogs.com/-Archenemy-/p/12032715.html