13. What is the difference between byte stream and character stream ?

toutbon·2024년 3월 5일
0

질문의 목적

  • byte stream 과 character stream의 차이

Java Stream

  • 데이터 소스나 destination 쪽에 연속적으로 access 해서 데이터를 읽어오는 전형적인 방법
  • file, program은 모두 데이터 소스나 destination이 될 수 있다
  • input Stream : from source to program, 데이터를 읽는 경우
  • output Stream : from program to source, 데이터를 쓰는 경우

데이터가 흘러들어가고 나올수 있는 것을 stream 이라 한다.

Byte Stream vs. Character Stream

Byte Stream

  1. reading/writing of any bytes(이미지, 미디어 파일등의 binary data 처리가능), raw data
  2. contains 8 bit 단위
  3. InputStream/ OutputStream classes 의 계층을 따름

Character stream

  • byte stream이 있음에도 2 byte 전용 character stream을 디자인 한 이유 ?
    - 자바에서 기본 코드인 unicode를 담기위함
  1. reading/writing of character, text
  2. contains 16bits unicode 단위
  3. Reader/Writer classes 의 계층을 따름
profile
뚜봉

0개의 댓글