Java Programming Language 3 InputOutput Stream Company Logo
- Slides: 21
Java Programming Language (3) - Input/Output Stream – Company Logo @ Dong In Shin DCS lab Seoul National University
Stream n Stream? n n Why JAVA uses Stream? n n n Input source 또는 output destination을 갖는 순서화된 일련의 자료(sequence of bytes)를 나타내는 abstract input/output model I/O device에 독립적인 입출력 방식을 제공 대부분의 method는 throws IOException java. io package내의 모든 exception class는 IOException의 직간접적인 하위 클래스이다. dishin@dcslab. snu. ac. kr
Input/Output Stream Data Program Input Stream Data dishin@dcslab. snu. ac. kr Output Stream
Stream Input/Output class의 종류 n 입출력 자료 종류 n Byte stream : Input. Stream , Output. Stream n n Character stream : Reader , Writer n n Binary data 또는 byte 단위의 문자 자료의 입출력 방법 제공 Unicode(2 byte) 문자 자료의 입출력 방법 제공 입출력 장치 종류 n 입출력 장치 종류(file, network, …)에 따라 다른 stream class 들에 의해 지원 dishin@dcslab. snu. ac. kr
Stream Input/Output class의 종류 n 입출력 기능(filtering) n n 기존의 stream에 부가적인 입출력 기능을 추가하여 제공하 는 stream 문자 세트 변환 n n 자료값을 string 표현으로 출력 n n n Print. Writer, Print. Stream 버퍼링(buffering)… 자료의 내부 표현 값을 그대로 입출력 n n Input. Stream. Reader, Output. Stream. Writer Data. Input. Stream, Data. Output. Stream 객체 입출력 n Object. Input. Stream, Object. Output. Stream dishin@dcslab. snu. ac. kr
Byte Stream Classes dishin@dcslab. snu. ac. kr
Character Stream Classes dishin@dcslab. snu. ac. kr
Data Sink Stream Classes n String, file, pipe와 같이 특정한 data를 읽거나 쓸 때 사용한 다 Sink type Character stream Byte stream Memory Char. Array. Reader Char. Array. Writer Byte. Array. Input. Stream Byte. Array. Output. Stream String. Reader, String. Writer String. Buffered. Input. Stream (Deprecated. ) Piped. Reader Piped. Writer Piped. Input. Stream Piped. Output. Stream File. Reader File. Writer File. Input. Stream File. Output. Stream dishin@dcslab. snu. ac. kr
Input. Stream / Output. Stream n Abstract byte input/output stream class int read( ) int read(byte cbuf[ ]) int read(byte cbuf[], int offset, int length) int write(byte cbuf[ ]) int write(byte cbuf[], int offset, int length) void flush() void close() : stream을 닫을 때 사용하는 method dishin@dcslab. snu. ac. kr
File. Input. Stream / File. Output. Stream n n Input source 와 Output destination이 file인 byte stream class File. Input. Stream class construct n new File. Input. Stream(String name)throws File. Not. Found. Exception new File. Input. Stream(File file)throws File. Not. Found. Exception File. Output. Stream class n n New File. Output. Stream(String name, boolean append =false) throws File. Not. Found. Exception New File. Output. Stream(File file) throws File. Not. Found. Exception dishin@dcslab. snu. ac. kr
File. Input. Stream/ File. Output. Stream dishin@dcslab. snu. ac. kr
File. Input. Stream/ File. Output. Stream dishin@dcslab. snu. ac. kr
Standard I/O n 운영체제가 제공하는 기능에 의해 프로그램의 수정없이 다양한 입출력 장치(keyboard, monitor , file)로 입출력 제공 n 표준 입출력 객체 n Input. Stream System. in n n Output. Stream System. out n n Standard input stream (default 로 keyboard) Standard output stream (default로 monitor ) Print. Stream System. err n Standard error stream (default로 monitor) dishin@dcslab. snu. ac. kr
Standard I/O n result dishin@dcslab. snu. ac. kr
Reader/Writer n Input source로 부터 Unicode 문자 자료(char, char[], string)을 읽어들이고 제어할 수 있는 method를 제공하는 abstract character input/output stream class int read( ) int read(char cbuf[ ]) int read(char cbuf[], int offset, int length) int write(char cbuf[ ]) int write(char cbuf[], int offset, int length) n File. Reader/File. Writer : File. Input. Stream , File. Output. Stream과 기능이 거의 동일 dishin@dcslab. snu. ac. kr
Input. Stream. Reader/Output. Stream. Writer n n Byte stream 을 Character stream과 연결시켜 Unicode 문자를 입 출력 할 수 있다. Byte stream의 문자 인코딩을 지정. dishin@dcslab. snu. ac. kr
Input. Stream. Reader/Output. Stream. Writer dishin@dcslab. snu. ac. kr
Memory Stream dishin@dcslab. snu. ac. kr
Memory Stream dishin@dcslab. snu. ac. kr
I/O 관련 기본 exception class n java. io 및 java. net package의 모든 exception class는 java. io. IOException의 extended class n 따라서 IOException handling 만으로 모두 처리가능 dishin@dcslab. snu. ac. kr
Next n 입출력 기능에 따른 stream class(filtering) n n Buffering, string presentation… Object stream n 객체 직렬화( Serializable interface ) dishin@dcslab. snu. ac. kr
- Inputoutput devices
- Differentiate byte stream and character stream
- Fd msw
- Language logo
- C programming language logo
- Logo programming language
- Java language
- Pengertian stream
- Kelas dasar untuk kebanyakan kelas stream adalah
- Java oop exercises
- Java scanner stream
- Java peek stream
- What is hardware description language
- Perbedaan linear programming dan integer programming
- Greedy vs dynamic programming
- System programming vs application programming
- Integer programming vs linear programming
- Definisi integer
- Flair furniture company linear programming
- Flair furniture company linear programming
- Linear programming models: graphical and computer methods
- The scratch stage is 480 pixels wide and 360 pixels high.