8월, 2010의 게시물 표시

java 입출력2

FileInputStream FileInputStream(File file) - File 객체를 이용해서 FileInputStream 객체를 새성한다. FileInputStream(FileDescriptor fdObj)  - FileDescriptor 객체를 이용해서 FileInputStream 객체를 생성한다. FileInputStream(String name) - 파일 이름을 이용해서 FileInputStream 객체를 생성한다. void close() - 스트림을 닫는다. int read() - 한 바이트를 읽어서 리턴한다. int read(byte[] b, int off, int len) - len개의 바이트를 읽어서 배열 b[off]에서부터 저장한다. 리턴 값은 읽은 바이트 수이다. int read(byte[] b) - 배열의 크기만큼의 바이트를 읽는다. 리턴 값은 읽은 바이트 수이다. FileOutputStream FileOutputSteam(File file) - File 객체를 이용해서 FileOutputStream객체를 생성한다. FileOutputStream(FileDescriptor fdObj) - FileDescriptor 객체를 이용해서 FileOutputStream 객체를 생성한다. FileOutputStream(Stringn name, boolean append) - 파일 이름을 이용해서 FileOutputStream 객체를 생성한다. 생성된 객체는 append값에 따라 기존 파일에 내용을 추가할 것인지, 아닌지를 결정한다. append가 false 이면 기존 내용은 삭제하고 새로운 내용이 기록된다. FileOutputStream(String name) - 디폴트로 append가 false인 FileOutputStream 객체를 생성한다. void close() - 스트림을 닫는다. void write(byte[] b, int off, int len) - 배열 b[off]에서부터 len개의 바이트를 출력한다. void write(by