티스토리 뷰

종류별 스트림 1바이트 입출력 형식


1. 콘솔


출력


FileOutputStream fos = new FileOutputStream(FileDescriptor.out);

BufferedOutputStream bos = new BufferedOutputStream(fos, 1024);

DataOutputStream dos = new DataOutputStream(bos);

dos.write()


입력


FieInputStream fis = new FileInputStream(FileDescriptor.in);

BufferedInputStream bis = new BufferedInputStream(fis,1024);

DataInputStream dis = new DataInputStream(bis);

dis.read()


2. 파일


출력


File file = new File("filename");

FileOutputStream fos = new FileOutputStream(file, false);

BufferedOutputStream bos = new BufferedOutputStream(fos, 1024);

DataOutputStream dos  = new DataOutputStream(bos);

dos.write()


입력

File file = new File("filename");

FileInputStream fis = new FileInputStream(file);

BufferedInputStream bis = new BufferedInputStream(fis,1024);

DataInputStream dis = new dataInputStream(bis);

dis.read();


3. 네트워크


출력

Socket soc = new Socket();

BufferedOutputStream bos = new BufferedOutputStream(soc.getOutputStream(),1024);

DataOutpputStream dos = new DataOutputStream(bos);

dos.write()


입력

Socket soc = new Socket();

BufferedInoutStream bis = new BufferedInputStream(soc.getInputStream(),1024);

DataInputStream dis = new DataInputStream(bis);

dis.read()

'프로그래밍 언어 > 프로그래밍' 카테고리의 다른 글

[JAVA] 채팅 서버, 클라이언트 예제  (0) 2016.10.02
[유니티] 오브젝트 터치좌표로 이동하기  (0) 2016.06.17
유니티 점프  (0) 2016.06.08
해시 테이블 (hash table)  (0) 2009.01.18
트리  (0) 2009.01.18
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함