int read; long size = 0; while (( read = in.read(buffer)) != -1) { crc.update(buffer, 0, read); out.write(buffer, 0, read); size += read; } entry.setCrc( crc.getValue() ); entry.setSize( size ); in.close(); out.closeEntry(); crc.reset();
add(entry, in, out, crc, buffer);
	private static void addFile(File file, JarOutputStream out, CRC32 crc, int sourceDirLength, byte[] buffer) 	throws FileNotFoundException, IOException 	{		if (file.isDirectory()) {			File[] fileNames = file.listFiles();			for (int i = 0; i < fileNames.length; i++) {				addFile( fileNames[i], out, crc, sourceDirLength, buffer );			}		} else {			String entryName = file.getAbsolutePath().substring(sourceDirLength);			if (IS_WINDOWS) {					entryName = StringUtil.replace( entryName, '\\', '/' );			}			JarEntry entry = new JarEntry( entryName );			out.putNextEntry(entry);			// read file:			FileInputStream in = new FileInputStream( file );			int read;			long size = 0;			while (( read = in.read(buffer)) != -1) {				crc.update(buffer, 0, read);				out.write(buffer, 0, read);				size += read;			}			entry.setCrc( crc.getValue() );			entry.setSize( size );			in.close();			out.closeEntry();			crc.reset();		}	}