Re: Java Inflater problem decompressing packfile
- From
- madmarcos <fru574@my.utsa.edu>
- Date
- Apr 16, 2011, 14:58 UTC
- Message-ID
- <1302965899845-6279085.post@n2.nabble.com>
- In-Reply-To
- <1302964576373-6279050.post@n2.nabble.com>
here is some code that shows the problem. sorry if the formatting fails. not sure if I am supposed to use code tags or something.
try {
byte[] packFile = readFile("/Users/marcos/GitProxyCache/jedit.pack");
//THE BELOW OBJECT DECOMPRESSES FINE
//Object starts at index 8616
//Type = 3, Decompressed size = 2248 (uses 2 extra size bytes)
//byte [] packDataWindow = new byte[8000];
//System.arraycopy(packFile, 8619, packDataWindow, 0,
packDataWindow.length); //works
//THE BELOW OBJECT FAILS TO INFLATE
//IT CAUSES an "incorrect data check" error
//Object starts at index 9470
//Type = 3, Decompressed size = 51060 (uses 2 extra size bytes)
byte [] packDataWindow = new byte[8000];
System.arraycopy(packFile, 9473, packDataWindow, 0,
packDataWindow.length); //does not work Inflater decompresser = new Inflater();
decompresser.setInput(packDataWindow, 0, packDataWindow.length);
byte[] result = new byte[60000];
int resultLength = 0;
resultLength = decompresser.inflate(result);
String outputString = new String(result, 0, resultLength, "UTF-8");
System.out.println(outputString);
decompresser.end();
} catch (Exception e) {
e.printStackTrace();
}-- View this message in context: http://git.661346.n2.nabble.com/Java-Inflater-problem-decompressing-packfile-tp6278154p6279085.html Sent from the git mailing list archive at Nabble.com.