public void stop() { writer = null; try { serverSocket.close(); } catch (IOException e) { EclEmmaCorePlugin.getInstance() .getLog() .log(EclEmmaStatus.AGENTSERVER_STOP_ERROR.getStatus(e)); } cancel(); }
public void extract(IProgressMonitor monitor) throws CoreException { if (isArchive()) { monitor.beginTask(NLS.bind(CoreMessages.ExtractingSourceArchive_task, path), 1); String prefix = rootpath == null ? "" : rootpath.toString(); // $NON-NLS-1$ byte[] buffer = new byte[0x1000]; IPath srcfolder = EclEmmaCorePlugin.getInstance().getStateFiles().getSourceFolder(path); if (!srcfolder.toFile().exists()) { try { ZipInputStream zip = new ZipInputStream(new FileInputStream(path.toFile())); while (true) { ZipEntry entry = zip.getNextEntry(); if (entry == null) break; if (!entry.isDirectory() && entry.getName().startsWith(prefix) && entry.getName().endsWith(JAVA_EXT)) { IPath path = srcfolder.append(entry.getName().substring(prefix.length())); path.removeLastSegments(1).toFile().mkdirs(); OutputStream out = new FileOutputStream(path.toFile()); int len; while ((len = zip.read(buffer)) != -1) { out.write(buffer, 0, len); } out.close(); } zip.closeEntry(); } zip.close(); } catch (IOException e) { throw new CoreException(EclEmmaStatus.SOURCE_EXTRACTION_ERROR.getStatus(path, e)); } } path = srcfolder; rootpath = null; } monitor.done(); }