package com.jiayue.ipfcst.service;

import sun.misc.BASE64Encoder;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

/**
 * TODO
 *
 * @author xsl
 * @version 3.0
 */
public class Test {
  public static void main(String[] args) {
    String fileNameKey="1-E16-10008_qx-202103161410.rb";
    String tempFileName = fileNameKey;
    String[] tempKey = new String[3];
    tempKey[0] = tempFileName.substring(0,tempFileName.indexOf("-",0));
    tempFileName = tempFileName.substring(tempFileName.indexOf("-",0)+1);
    tempKey[1] = tempFileName.substring(0,tempFileName.indexOf("-",0));
    tempKey[2] = tempFileName.substring(tempFileName.indexOf("-",0)+1);



//    String str="T00001|1615737600000|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|0.00|";
//    ByteArrayOutputStream out = new ByteArrayOutputStream();
//    GZIPOutputStream gzip = null;
//    try {
//      gzip = new GZIPOutputStream(out);
//      gzip.write(str.getBytes());
//    } catch (IOException e) {
//      e.printStackTrace();
//    } finally {
//      if (gzip != null) {
//        try {
//          gzip.close();
//        } catch (IOException e) {
//          e.printStackTrace();
//        }
//      }
//    }
//    System.out.println(new BASE64Encoder().encode(out.toByteArray()));
//    String a="H4sIAAAAAAAAAAsxAALDGkMzQ1NzY3MzEM+gxkBvlBjOBAB0z9W49QEAAA==";
//    ByteArrayOutputStream out = new ByteArrayOutputStream();
//    ByteArrayInputStream in = null;
//    GZIPInputStream ginzip = null;
//    byte[] compressed = null;
//    String decompressed = null;
//    try {
//      compressed = new sun.misc.BASE64Decoder().decodeBuffer(a);
//      in = new ByteArrayInputStream(compressed);
//      ginzip = new GZIPInputStream(in);
//      byte[] buffer = new byte[1024];
//      int offset = -1;
//      while ((offset = ginzip.read(buffer)) != -1) {
//        out.write(buffer, 0, offset);
//      }
//      decompressed = out.toString();
//    } catch (IOException e) {
//      e.printStackTrace();
//    } finally {
//      if (ginzip != null) {
//        try {
//          ginzip.close();
//        } catch (IOException e) {
//        }
//      }
//      if (in != null) {
//        try {
//          in.close();
//        } catch (IOException e) {
//        }
//      }
//      if (out != null) {
//        try {
//          out.close();
//        } catch (IOException e) {
//        }
//      }
//    }
//    System.out.println(decompressed);
  }
}
