你好,我想问一下如何在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();