git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: madmarcos <fru574@my.utsa.edu>
To: git@vger.kernel.org
Subject: Re: Java Inflater problem decompressing packfile
Date: Sat, 16 Apr 2011 17:40:24 -0700 (PDT)	[thread overview]
Message-ID: <1303000824677-6280097.post@n2.nabble.com> (raw)
In-Reply-To: <1302969047343-6279183.post@n2.nabble.com>

someone on the Java forums asked if I knew that the file was being read
completely before inflating. Well... I just assumed (yes, I know not a good
thing to do).
So here is my readFile code in case you want to see it:

public byte [] readFile(String fileName) {
		byte [] input2 = null;
	    File tempPackInputFile2 = new File(fileName);
		InputStream tempPackInputStream2;
		try {
			tempPackInputStream2 = new FileInputStream(tempPackInputFile2);
			long tempPackLength2 = tempPackInputFile2.length();
			input2 = new byte[(int) tempPackLength2];
			// Read in the bytes
		    int offset2 = 0;
		    int numRead2 = 0;
		    while (offset2 < input2.length
		           && (numRead2 = tempPackInputStream2.read(input2, offset2,
input2.length-offset2)) >= 0) {
		        offset2 += numRead2;
		    }
		    tempPackInputStream2.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	    return input2;
	}

--
View this message in context: http://git.661346.n2.nabble.com/Java-Inflater-problem-decompressing-packfile-tp6278154p6280097.html
Sent from the git mailing list archive at Nabble.com.

  reply	other threads:[~2011-04-17  0:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-16  2:05 Java Inflater problem decompressing packfile madmarcos
2011-04-16  6:37 ` Jeff King
2011-04-16 14:23   ` madmarcos
2011-04-16 14:36     ` madmarcos
2011-04-16 14:58       ` madmarcos
2011-04-16 15:50         ` madmarcos
2011-04-17  0:40           ` madmarcos [this message]
2011-04-17  4:02             ` madmarcos
2011-04-17  4:06               ` madmarcos
2011-04-17  4:36     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303000824677-6280097.post@n2.nabble.com \
    --to=fru574@my.utsa.edu \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).