write(destinationPath, output.toByteArray());
IPath fileLocation= resource.getLocation(); long lastModified= System.currentTimeMillis(); if (fileLocation != null) { File file= new File(resource.getLocation().toOSString()); if (file.exists()) lastModified= file.lastModified(); } write(destinationPath, output.toByteArray(), lastModified);
	public void write(IFile resource, IPath destinationPath) throws IOException, CoreException {		ByteArrayOutputStream output= null;		BufferedInputStream contentStream= null;		try {			output= new ByteArrayOutputStream();			if (!resource.isLocal(IResource.DEPTH_ZERO))				throw new IOException(JarPackagerMessages.getFormattedString("JarWriter.error.fileNotAccessible", resource.getFullPath())); //$NON-NLS-1$			contentStream= new BufferedInputStream(resource.getContents(false));			int chunkSize= contentStream.available();			byte[] readBuffer= new byte[chunkSize];			while (contentStream.read(readBuffer, 0, chunkSize) > 0)				output.write(readBuffer);		} finally {			if (output != null)				output.close();			if (contentStream != null)				contentStream.close();		}		try {			write(destinationPath, output.toByteArray());		} catch (IOException ex) {			// Ensure full path is visible			String message= JarPackagerMessages.getFormattedString("JarWriter.writeProblem", resource.getFullPath()); //$NON-NLS-1$			if (ex.getMessage() != null)				message += ": " + ex.getMessage();  //$NON-NLS-1$			throw new IOException(message);		}			}