{ ByteArrayInputStream input = new ByteArrayInputStream(s.getBytes("UTF-8")); ByteArrayOutputStream output = new ByteArrayOutputStream(1024); GZIPOutputStream gzout = new GZIPOutputStream(output); byte[] buf=new byte[1024]; int number; { gzout.write(buf,0,number); } gzout.close(); input.close(); String result =new BASE64Encoder().encode(output.toByteArray()); output.close(); return result; } { ByteArrayOutputStream output = new ByteArrayOutputStream(1024); ByteArrayInputStream input = new ByteArrayInputStream(new BASE64Decoder().decodeBuffer(data)); GZIPInputStream gzinpt = new GZIPInputStream(input); byte[] buf = new byte[1024]; int number = 0; { output.write(buf,0,number); } gzinpt.close(); input.close(); String result = new String(output.toString("UTF-8")); output.close(); return result; } 相关文章: 2021-11-30 2022-02-07 2021-12-28 2022-01-23 2022-12-23 2022-12-23 2021-08-24 2022-12-23