고급 자바_1229-2
바이트 기반 스트림에 대하여 알아보겠습니다. InputStream의 메서드 OutputStream의 메서드 두가지가 있으며 byte[] inSrc = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; byte[] outSrc = null; ByteArrayInputStream input = new ByteArrayInputStream(inSrc); ByteArrayOutputStream output = new ByteArrayOutputStream(); int data;//읽어온 자료가 저장될 변수 // read() 메서드 ==> 더 이상 읽어올 자료가 없으면 -1을 반환한다. 끝까지 왔나 비교하기 위해 -1과 비교 while((data = input.read()) != -1 ) {// 입력 ou..
카테고리 없음
2022. 12. 29. 12:50