b0fc0928fd68001c1062ba55e86abf57
来自「这是我自己照着书上敲的」· 代码 · 共 45 行
TXT
45 行
/*
* Created on 2007-9-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.io.*;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class RWMemory
{
public static void main(String args[])
{
byte b[]={65,66,67,68,69,70,71,72,73,74};
try
{
ByteArrayInputStream bin=new ByteArrayInputStream(b[]);
ByteArrayOutputStream bout=new ByteArrayOutputStream();
int n=bin.avialable();
bin.skip(n/2);
int m;
while((m=bin.read())!=-1)
{
bout.write(m);
}
System.out.println("read write half data"+bout);
bin.reset();
bout.reset();
int k=b.length;
byte rb[]=new byte[k];
bin.read(rb[],0,10);
bout.write(rb[],0,10);
System.out.println("read write all data"+bout.toString());
}
catch(IOException e)
{
System.out.println("error"+e);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?