Input Stream Reader isr new Input Stream Reader
- Slides: 16
노드와 필터를 연결하는 법 Input. Stream. Reader isr = new Input. Stream. Reader( System. in ); 필터스트림클래스 변수 필터스트림 클래스 노드스트림객체 Buffered. Reader in = new Buffered. Reader( isr ); 필터스트림객체 Page 5
노드 스트림과 관련된 필터 스트림 노드 스트림 관련된 리더/라이터 관련된 버퍼 입력 Input. Stream Inpu. Stream. Reader Buffered. Input. Stream File. Reader Filter. Input. Stream Filtered. Reader Data. Input. Stream 출력 Output. Stream Ouput. Stream. Writer Buffered. Output. Stream File. Writer Filter. Output. Stream Filter. Writer Data. Output. Stream Print. Stream Page 6
리더 Page 8
파일 읽기 예제 1 : import java. io. *; 2: 3 : public class My. File. Reader 읽어올 파일 이름 4: { 5 : public static void main(String[] args) 6: { 7: int i; 8: 9: try{ 10 : File. Reader in= new File. Reader("My. File. Reader. java"); 11 : 12 : while((i=in. read())!=-1){ 13 : char my. Char= (char)i; 파일의 끝까지 반복 14 : System. out. print(my. Char); 15 : } 16 : }catch(IOException e){ 17 : System. out. println(e. to. String()); 18 : }. . . Page 9
키보드 읽기 예제 1 : import java. io. *; Input. Stream 객체 2: 3 : public class My. Buffered. Reader 4: { 5 : public static void main(String[] args) 6: { 7: Input. Stream. Reader is. Reader= new Input. Stream. Reader(System. in); 8: Buffered. Reader in= new Buffered. Reader(is. Reader); 9: 10 : try{ 11 : String str= in. read. Line(); // 엔터키를 누를 때까지 한 줄을 입력받음 12 : System. out. print(str); 13 : }catch(IOException e){ 14 : System. out. println(e. to. String()); 15 : } 16 : } 17 : } Page 10
라이터 Page 12
파일 복사 예제. . . 7: 8: 9: 10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 : 20 : . . . try{ File. Reader in= new File. Reader("DATA 1. txt"); File. Writer out= new File. Writer("DATA 2. txt"); int ch; while((ch= in. read())!=-1){ out. write(ch); } 읽어올 파일 저장할 파일 in. close(); out. close(); }catch(IOException e){ System. out. println(e. to. String()); } Page 13
화면 출력 예제 1 : import java. io. *; Print. Stream 객체 2: 3 : public class My. Output. Stream. Writer 4: { 5 : public static void main(String[] args) 6: { 7: Output. Stream. Writer out= new Output. Stream. Writer(System. out); 8: 9: try{ 10 : out. write("자바 2 프로그래밍"); 11 : out. flush(); 12 : }catch(IOException e){ 13 : System. out. println(e. to. String()); 14 : } 15 : } 16 : } Page 14
File 클래스. . . 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 : File my. File= new File(args[0]); : : if(my. File. exists()){ : System. out. println("파일이름: "+ my. File. get. Name()); : System. out. println("상대경로: "+ my. File. get. Path()); : System. out. println("절대경로: "+ my. File. get. Absolute. Path()); : System. out. println("쓰기가능: "+ my. File. can. Write()); : System. out. println("읽기가능: "+ my. File. can. Read()); : System. out. println("파 일: "+ my. File. is. File()); : System. out. println("디렉토리: "+ my. File. is. Directory()); : System. out. println("파일크기: "+ my. File. length()); : }else{ : System. out. println("파일이 없습니다. "); : } : } Page 15
Random. Access. File 클래스. . . 7: 8: 9: 10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : byte[] my. Data= { 11, 22, 33, 44, 55, 66, 77, 88, 99 }; r: 읽기, w: 쓰기 try{ Random. Access. File rand= new Random. Access. File("temp. dat", "rw"); // 파일에 쓰기 rand. write(my. Data); // 파일에 배열을 저장 읽어올 파일 // 파일에서 반대로 읽기 for(int i= my. Data. length-1; i>=0; i--) { 19 : rand. seek(i); // 파일 포인터를 이동 20 : 21 : . . . System. out. println(rand. read()); } Page 16
- Isr forum
- Cual es el isr en mexico
- Arbitrios en guatemala
- Isr-ccp-exp
- Avaluo referido isr
- Como se calcula el isr
- Differentiate byte stream and character stream
- Touch screen input or output
- Is optical mark reader input or output
- Literary devices scanner
- Input and output devices notes
- Kelas dasar untuk kebanyakan kelas stream adalah
- Data stream java
- Cout setf ios fixed
- New mexico interstate stream commission
- Contoh perangkat peripheral output yaitu
- Characteristics of natural approach