读取解密后的文件内容

最近在做某某银行的接口时,需要下载处理结果文件,解密后读取里面的内容进行业务处理。这里记录下

解密后的文件内容:



代码如下:



public void test() throws IOException{
String path = File.separator;
File file = new File("D:"+path+"DEMO"+path+"client"+path+"download"+path+"30040000"+path+"3004-APPZX0002RES-000006-20160510");
System.out.println(file);
FileInputStream fileInputStream = new FileInputStream(file);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream,"GBK");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
// System.out.println(bufferedReader.readLine());
char[] charer = new char[364];
String line = null;
while((line = bufferedReader.readLine()) != null){
System.out.println(line);
byte[] data = line.getBytes("GBK");
  byte[] CARDNBR = new byte[19];
System.arraycopy(data, 0, CARDNBR, 0, 19);
System.out.println(new String(CARDNBR));

byte[] IDNO  = new byte[18];
System.arraycopy(data, 19, IDNO, 0, 18);
System.out.println(new String(IDNO));

byte[] IDTYPE  = new byte[2];
System.arraycopy(data, 37, IDTYPE, 0, 2);
System.out.println(new String(IDTYPE));

byte[] FLAG  = new byte[1];
System.arraycopy(data, 39, FLAG, 0, 1);
System.out.println(new String(FLAG));

byte[] ERRCODE  = new byte[3];
System.arraycopy(data, 40, ERRCODE, 0, 3);
System.out.println(new String(ERRCODE));

byte[] NAME  = new byte[60];
System.arraycopy(data, 43, NAME, 0, 60);
System.out.println(new String(NAME,"GBK"));

byte[] ACCTYPE  = new byte[1];
System.arraycopy(data, 103, ACCTYPE, 0, 1);
System.out.println(new String(ACCTYPE));

byte[] APPID  = new byte[60];
System.arraycopy(data, 104, APPID, 0, 60);
System.out.println(new String(APPID));

byte[] MOPHONE  = new byte[12];
System.arraycopy(data, 164, MOPHONE, 0, 12);
System.out.println(new String(MOPHONE));

byte[] INFO  = new byte[100];
System.arraycopy(data, 176, INFO, 0, 100);
System.out.println(new String(INFO));

byte[] REVERS  = new byte[88];
System.arraycopy(data, 276, REVERS, 0, 88);
System.out.println(new String(REVERS));
}
 
    bufferedReader.close();
  inputStreamReader.close();
  fileInputStream.close();
   
  }



处理结果如下:





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值