Re: How does one Compress and Decompress text to Card Files


[ Follow Ups ] [ BasicCard User Forum ]

Posted by ngonidan (217.74.238.26) on September 30, 2011 at 05:28:26:

I got a working Solution. BUT i am halfway to accomplishing what i want. The solution below works for One line of string.


Writing a Compressed byte array to Basic Card file:

OutputStream regionFilestream = regionFile.sysOpenAsOutputStream();
PrintStream regionFileout2 = new PrintStream(regionFilestream);


byte [] b = compressBytes(strTxt);


regionFileout2.write(b);
regionFileout2.flush();
regionFileout2.close();

Reading a Compressed byte array from Basic Card file and uncompressing it:


InputStream regionFilestream = regionFile.sysOpenAsInputStream();

BufferedInputStream bis = new BufferedInputStream(regionFilestream);

byte[] byBuf = new byte[1024];
int byteRead = bis.read(byBuf,0,1024);
String UncompressedString = extractBytes(byBuf);


NOW, i want to write multiple lines of byte arrays to a basic Card file how do i do it????





Follow Ups:


[ Follow Ups ] [ BasicCard User Forum ]