package com.breeziness123.io;
import java.io.ByteArrayInputStream;
/**
* 字节数组流,从内存中读取
* 不需要关闭流,close()方法是一个空方法
*
* @author breeziness
*
*/
public class IODemo05 {
public static void main(String[] args) {
// TODO Auto-generated method stub
byte[] buff = "this is abc".getBytes();
byteArrayTest(buff);
}
public static void byteArrayTest(byte[] source) {
ByteArrayInputStream ba = null;
int temp = 0;
ba = new ByteArrayInputStream(source);
while((temp = ba.read())!= -1) {
System.out.print((char)temp);
}
}
}
字节数组流
猜你喜欢
转载自blog.csdn.net/qq_40731414/article/details/86531141
今日推荐
周排行