java1 [JAVA] Java에서 InputStream 변환 Byte Array ByteBuffer java로 파일전송을 하거나 파일을 다루게 되는 경우 Stream을 Byte로 바꿔서 다뤄줘야 하는 경우에 사용하게 된다. 1. Byte Array 로 변경하는 방법 InputStream is = new ByteArrayInputStream(new byte[] { 0, 1, 2 }); byte[] targetArray = new byte[is.available()]; is.read(targetArray); InputStream is =new ByteArrayInputStream(newbyte[] { 0, 1, 2, 3, 4, 5, 6 }); // not really known ByteArrayOutputStream buffer =new ByteArrayOutputStream(); int nRead; by.. 2021. 8. 26. 이전 1 다음