Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

import txt.xz file to android studio app

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
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #import #file #android #studio #app
ADD COMMENT
Topic
Name
3+6 =