有时候我们需要对同一个InputStream对象使用多次。
但第一次读取InputStream对象后,第二次再读取时可能已经到Stream的结尾了(EOFException)或者Stream已经close掉了。
而InputStream对象本身不能复制,因为它没有实现Cloneable接口。此时,可以先把InputStream转化成ByteArrayOutputStream,后面要使用InputStream对象时,再从ByteArrayOutputStream转化回来就好了。代码实现如下:
有时候我们需要对同一个InputStream对象使用多次。
但第一次读取InputStream对象后,第二次再读取时可能已经到Stream的结尾了(EOFException)或者Stream已经close掉了。
而InputStream对象本身不能复制,因为它没有实现Cloneable接口。此时,可以先把InputStream转化成ByteArrayOutputStream,后面要使用InputStream对象时,再从ByteArrayOutputStream转化回来就好了。代码实现如下:
通过etcd删除,亲测可行.[root@k8s-node1 dark]# kubectl get ns |grep TNAME STATUS AGEedison Terminating 6h27mwu
java InputStream read方法内部有一个,postion,标志当前流读取到的位置,每读取一次,位置就
总结了最近解决LIO驱动corruption的思路、过程和经验。
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M