Javadoc归类

2017-03-03  本文已影响0人  进击的勇士

第一级别:精读源码

java.io

Provides for system input and output through data streams, serialization and the file system.

Ensential interfaces
  1. DataInput: binary stream->bytes->java primitive type
  2. DataOutput: java primitive type->bytes->binary stream
  3. Serializable: mark as serializable
  4. FileNameFilter
  5. FileFilter
Ensential classes
image
  1. InputStream/OutputStream<-->Reader/Writer
  2. BufferedInputStream/BufferedOutputStream<-->BufferedReader/BufferedWriter
  3. ByteArrayInputStream/ByteArrayOutputStream<-->CharArrayReader/CharArrayWriter
  4. PipeInputStream/PipeOutputStream<-->PipeReader/PipeWriter
  5. FileInputStream/FileOutputStream<-->FileReader/FileWriter
  6. FilterInputStream/FilterOutputStream<-->FilterReader/FilterWriter

  1. StringBufferInputStream<-->StringReader/StringWriter

  1. DataInputStream/DataOutputStream
  2. ObjectInputStream/ObjectOutputStream
  3. PriterWriter/PriterReader
  4. SequenceInputStream

Main Useage

一、按数据来源(去向)分类:

  1. 是文件: FileInputStream, FileOutputStream, ( 字节流 )FileReader, FileWriter( 字符 )
  2. 是 byte[] : ByteArrayInputStream, ByteArrayOutputStream( 字节流 )
  3. 是 Char[]: CharArrayReader, CharArrayWriter( 字符流 )
  4. 是 String: StringBufferInputStream, StringBufferOuputStream ( 字节流 )StringReader, StringWriter( 字符流 )
  5. 网络数据流: InputStream, OutputStream,( 字节流 ) Reader, Writer( 字符流 )

二、按是否格式化输出分:

  1. 要格式化输出: PrintStream, PrintWriter

三、按是否要缓冲分:

  1. 要缓冲: BufferedInputStream, BufferedOutputStream,( 字节流 ) BufferedReader, BufferedWriter( 字符流 )

四、按数据格式分:

  1. 二进制格式(只要不能确定是纯文本的) : InputStream, OutputStream 及其所有带 Stream 结束的子类
  2. 纯文本格式(含纯英文与汉字或其他编码方式); Reader, Writer 及其所有带 Reader, Writer 的子类

五、按输入输出分:

  1. 输入: Reader, InputStream 类型的子类
  2. 输出: Writer, OutputStream 类型的子类

六、特殊需要:

  1. 从 Stream 到 Reader,Writer 的转换类: InputStreamReader, OutputStreamWriter
  2. 对象输入输出: ObjectInputStream, ObjectOutputStream
  3. 进程间通信: PipeInputStream, PipeOutputStream, PipeReader, PipeWriter
  4. 合并输入: SequenceInputStream
  5. 更特殊的需要: PushbackInputStream, PushbackReader, LineNumberInputStream, LineNumberReader

决定使用哪个类以及它的构造进程的一般准则如下(不考虑特殊需要):

  1. 考虑最原始的数据格式是什么: 原则四
  2. 是输入还是输出:原则五
  3. 是否需要转换流:原则六第 1 点
  4. 数据来源(去向)是什么:原则一
  5. 是否要缓冲:原则三 (特别注明:一定要注意的是 readLine() 是否有定义,有什么比 read, write 更特殊的输入或输出方法)
  6. 是否要格式化输出:原则二

java.lang

Provides classes that are fundamental to the design of the Java programming language.

Ensential interfaces

  1. Comparable
  2. Iterable
  3. Runnable

Ensenti classes

  1. Object
  2. Number
  3. Boolean/Byte/Short/Integer/Long/Float/Double/Character
  4. Class/ClassLoader
  5. Enum/StrictMath/Math
  6. Package/Void/Runtime/Throwable
  7. Process/ProcessBuilder/Thread/ThradLocal/ThreadGroup
  8. System/SecurityManager
  9. String/StringBuffer(很多方法加了synchronized)/StringBuilder

java.util

Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).

Ensential interfaces

imageimage
  1. Collection/Set/SortedSet/List/ListIterator/Deque/Queue/SortedMap/Map/Map.Entry
  2. Comparator
  3. Enumeration
  4. EventListener
  5. Iterator

Ensenti classes

第二级别:深刻理解

第三级别:会用即可

第四级别:请无视它

上一篇下一篇

猜你喜欢

热点阅读