git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Java Inflater problem decompressing packfile

From
Mmadmarcos <fru574@my.utsa.edu>
Date
Apr 17, 2011, 00:40 UTC
Message-ID
<1303000824677-6280097.post@n2.nabble.com>
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.

Previous: madmarcosNext: madmarcos
Message 7 of 10 in “Java Inflater problem decompressing packfile”
  1. madmarcosApr 16, 2011
  2. Jeff KingApr 16, 2011
  3. madmarcosApr 16, 2011
  4. madmarcosApr 16, 2011
  5. madmarcosApr 16, 2011
  6. madmarcosApr 16, 2011
  7. madmarcosApr 17, 2011
  8. madmarcosApr 17, 2011
  9. madmarcosApr 17, 2011
  10. Jeff KingApr 17, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.