📜  将 txt.xz 文件导入到 android studio 应用程序 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:20.688000             🧑  作者: Mango

代码示例1
public static void main(String[] args){
  String input = "Some string blah blah blah";
  System.out.println("XZ or LZMA2 library.....");

  // If you are using some file instead of plain text you have to 
  //convert it to bytes here and pass it to `compress` method.

  byte[] xzCompressed = XZ_LZMA2.compress(input);
  System.out.println("Input length:" + input.length());
  System.out.println("XZ Compressed Length: "+ xzCompressed.length);
  String xzDecompressed = XZ_LZMA2.decompress(xzCompressed);
  System.out.println("XZ Decompressed : "+ xzDecompressed);

  // If you are using decompression for some compressed file instead of
  // plain text return bytes from `decompress` method and put it in 
  //FileOutputStream to get file back
}