byte[] buff = new byte[1024]; java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();is.skip(13);while(true){ int cnt = is.read(buff); if(cnt > 0) bos.write(buff, cnt); if(cnt < buff.length) break; }buff = bos.toByteArray(); String str = new String(buff, "GBK");只要将GBK换成你要的编码即可
FileInputStream ins = new FileInputStream("d:/test.txt");
ins.skip(13); BufferedInputStream br = new BufferedInputStream(ins); System.out.println(br.available()); byte[] b = new byte[br.available()]; br.read(b); System.out.println(new String(b),"utf-8");
java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();is.skip(13);while(true){
int cnt = is.read(buff);
if(cnt > 0)
bos.write(buff, cnt);
if(cnt < buff.length)
break;
}buff = bos.toByteArray();
String str = new String(buff, "GBK");只要将GBK换成你要的编码即可
ins.skip(13);
BufferedInputStream br = new BufferedInputStream(ins);
System.out.println(br.available());
byte[] b = new byte[br.available()];
br.read(b);
System.out.println(new String(b),"utf-8");