Flutter拉链和解压

时间:2018-08-23 09:13:11

标签: flutter flutter-dependencies

你好,我想问一下如何在Flutter中压缩和解压缩成为字符串:

示例:

final int BUFFER_SIZE = 40;
    ByteArrayInputStream is = new ByteArrayInputStream(compressed);
    GZIPInputStream gis = new GZIPInputStream(is, BUFFER_SIZE);
    StringBuilder string = new StringBuilder();
    byte[] data = new byte[BUFFER_SIZE];
    int bytesRead;
    while ((bytesRead = gis.read(data)) != -1) { string.append(new String(data, 0, bytesRead)); }
    gis.close();
    is.close();
    return string.toString();

0 个答案:

没有答案