List of usage examples for java.util.zip GZIPOutputStream GZIPOutputStream
public GZIPOutputStream(OutputStream out) throws IOException
From source file:cn.sharesdk.net.NetworkHelper.java
public static String Base64Gzip(String str) { ByteArrayInputStream bais = new ByteArrayInputStream(str.getBytes()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); String result = null;/* w ww . j a va2s.c o m*/ // gzip GZIPOutputStream gos; try { gos = new GZIPOutputStream(baos); int count; byte data[] = new byte[1024]; while ((count = bais.read(data, 0, 1024)) != -1) { gos.write(data, 0, count); } gos.finish(); gos.close(); byte[] output = baos.toByteArray(); baos.flush(); baos.close(); bais.close(); result = Base64.encodeToString(output, Base64.NO_WRAP); } catch (IOException e) { e.printStackTrace(); Ln.i("NetworkHelper", "Base64Gzip == >>", e); } return result; }
From source file:org.dkpro.lab.storage.filesystem.FileSystemStorageService.java
@Override public void storeBinary(String aContextId, String aKey, StreamWriter aProducer) { File context = getContextFolder(aContextId, false); File tmpFile = new File(context, aKey + ".tmp"); File finalFile = new File(context, aKey); OutputStream os = null;//from w w w . ja va 2s . co m try { tmpFile.getParentFile().mkdirs(); // Necessary if the key addresses a sub-directory log.debug("Storing to: " + finalFile); os = new FileOutputStream(tmpFile); if (aKey.endsWith(".gz")) { os = new GZIPOutputStream(os); } aProducer.write(os); } catch (Exception e) { tmpFile.delete(); throw new DataAccessResourceFailureException(e.getMessage(), e); } finally { Util.close(os); } // On some platforms, it is not possible to rename a file to another one which already // exists. So try to delete the target file before renaming. if (finalFile.exists()) { boolean deleteSuccess = finalFile.delete(); if (!deleteSuccess) { throw new DataAccessResourceFailureException( "Unable to delete [" + finalFile + "] in order to replace it with an updated version."); } } // Make sure the file is only visible under the final name after all data has been // written into it. boolean renameSuccess = tmpFile.renameTo(finalFile); if (!renameSuccess) { throw new DataAccessResourceFailureException( "Unable to rename [" + tmpFile + "] to [" + finalFile + "]"); } }
From source file:edu.snu.leader.hidden.ResultsReporter.java
/** * Initialize this reporter//from w w w . j av a 2 s . c om * * @param simState */ public void initialize(SimulationState simState) { _LOG.trace("Entering initialize( simState )"); // Save the simulation state _simState = simState; // Grab the properties Properties props = simState.getProps(); // Build some variables int individualCount = _simState.getIndividualCount(); _movementCounts = new int[individualCount + 1]; _finalInitiatorCounts = new int[individualCount + 1]; _finalSuccessfulInitiatorCounts = new int[individualCount + 1]; _finalFailedInitiatorCounts = new int[individualCount + 1]; _maxInitiatorCounts = new int[individualCount + 1]; _maxSuccessfulInitiatorCounts = new int[individualCount + 1]; _maxFailedInitiatorCounts = new int[individualCount + 1]; // Load the results filename String resultsFile = props.getProperty(_RESULTS_FILE_KEY); Validate.notEmpty(resultsFile, "Results file may not be empty"); // Create the statistics writer try { _writer = new PrintWriter(new BufferedWriter(new FileWriter(resultsFile))); } catch (IOException ioe) { _LOG.error("Unable to open results file [" + resultsFile + "]", ioe); throw new RuntimeException("Unable to open results file [" + resultsFile + "]", ioe); } // Log the system properties to the stats file for future reference _writer.println("# Started: " + (new Date())); _writer.println(_SPACER); _writer.println("# Simulation properties"); _writer.println(_SPACER); List<String> keyList = new ArrayList<String>(props.stringPropertyNames()); Collections.sort(keyList); Iterator<String> iter = keyList.iterator(); while (iter.hasNext()) { String key = iter.next(); String value = props.getProperty(key); _writer.println("# " + key + " = " + value); } _writer.println(_SPACER); _writer.println(); _writer.flush(); // Do we log simulations? String useSimLogFileStr = props.getProperty(_USE_SIM_LOG_FILE_FLAG_KEY); if (null != useSimLogFileStr) { _useSimLogFile = Boolean.parseBoolean(useSimLogFileStr); _LOG.info("Using _useSimLogFile=[" + _useSimLogFile + "]"); } if (_useSimLogFile) { // Build the compressed simulation log file int lastDotIdx = resultsFile.lastIndexOf('.'); String simLogFile = resultsFile.substring(0, lastDotIdx) + ".log.gz"; _LOG.warn("Sending simulation log to [" + simLogFile + "]"); // Build the log writer try { _logWriter = new PrintWriter(new BufferedWriter( new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(simLogFile))))); } catch (IOException ioe) { _LOG.error("Unable to open simulation log file [" + simLogFile + "]", ioe); throw new RuntimeException("Unable to open simulation log file [" + simLogFile + "]", ioe); } } // Do we log locations? String useLocationLogFileStr = props.getProperty(_USE_LOCATION_LOG_FILE_FLAG_KEY); if (null != useLocationLogFileStr) { _useLocationLogFile = Boolean.parseBoolean(useLocationLogFileStr); _LOG.info("Using _useLocationLogFile=[" + _useLocationLogFile + "]"); } if (_useLocationLogFile) { // Build the compressed location log file int lastDotIdx = resultsFile.lastIndexOf('.'); String simLocationFile = resultsFile.substring(0, lastDotIdx) + ".locations"; // + ".locations.gz"; _LOG.warn("Sending location log to [" + simLocationFile + "]"); // Build the location log writer try { _locationWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter( // new GZIPOutputStream( new FileOutputStream(simLocationFile)))); // ); } catch (IOException ioe) { _LOG.error("Unable to open location log file [" + simLocationFile + "]", ioe); throw new RuntimeException("Unable to open location log file [" + simLocationFile + "]", ioe); } } _LOG.trace("Leaving initialize( simState )"); }
From source file:CompressionResponseStream.java
public void writeToGZip(byte b[], int off, int len) throws IOException { if (debug > 1) { System.out.println("writeToGZip, len = " + len); }//from w w w . j a v a 2 s .co m if (debug > 2) { System.out.print("writeToGZip("); System.out.write(b, off, len); System.out.println(")"); } if (gzipstream == null) { if (debug > 1) { System.out.println("new GZIPOutputStream"); } response.addHeader("Content-Encoding", "gzip"); gzipstream = new GZIPOutputStream(output); } gzipstream.write(b, off, len); }
From source file:adams.data.io.output.AbstractSpreadSheetWriter.java
/** * Writes the spreadsheet in CSV format to the given file. * Handles compression automatically, if the filename ends with ".gz", * {@link #supportsCompressedOutput()} returns true and file is not * being appended./* w ww.ja v a2s. c om*/ * * @param content the spreadsheet to write * @param filename the file to write the spreadsheet to * @return true if successfully written * @see #supportsCompressedOutput() * @see AppendableSpreadSheetWriter */ @Override public boolean write(SpreadSheet content, String filename) { boolean result; BufferedWriter writer; OutputStream output; boolean append; AppendableSpreadSheetWriter appendable; result = true; preWriteFile(filename); append = false; if (this instanceof AppendableSpreadSheetWriter) { appendable = (AppendableSpreadSheetWriter) this; append = appendable.isAppending(); if (append) { appendable.setFileExists(new File(filename).exists()); append = appendable.canAppend(content); } } writer = null; output = null; try { switch (getOutputType()) { case FILE: result = doWrite(content, filename); break; case STREAM: output = new FileOutputStream(filename, append); if (!append && canCompress(filename)) output = new GZIPOutputStream(output); result = doWrite(content, output); output.flush(); break; case WRITER: output = new FileOutputStream(filename, append); if (!append && canCompress(filename)) output = new GZIPOutputStream(output); if (m_Encoding != null) writer = new BufferedWriter(new OutputStreamWriter(output, m_Encoding.charsetValue())); else writer = new BufferedWriter(new OutputStreamWriter(output)); result = doWrite(content, writer); writer.flush(); break; default: throw new IllegalStateException("Unhandled output type: " + getOutputType()); } } catch (Exception e) { result = false; e.printStackTrace(); } finally { FileUtils.closeQuietly(writer); FileUtils.closeQuietly(output); } return result; }
From source file:bookkeepr.jettyhandlers.WebHandler.java
public void handle(String path, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException { if (path.equals("/")) { response.sendRedirect("/web/"); }//ww w . j a v a 2 s . co m HttpClient httpclient = null; if (path.startsWith("/web/xmlify")) { ((Request) request).setHandled(true); if (request.getMethod().equals("POST")) { try { String remotePath = path.substring(11); BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream())); XMLAble xmlable = null; try { xmlable = httpForm2XmlAble(reader.readLine()); } catch (BookKeeprException ex) { response.sendError(400, "Server could not form xml from the form data you submitted. " + ex.getMessage()); return; } if (xmlable == null) { response.sendError(500, "Server could not form xml from the form data you submitted. The server created a null value!"); return; } // XMLWriter.write(System.out, xmlable); // if(true)return; HttpPost httppost = new HttpPost(bookkeepr.getConfig().getExternalUrl() + remotePath); httppost.getParams().setBooleanParameter("http.protocol.strict-transfer-encoding", false); ByteArrayOutputStream out = new ByteArrayOutputStream(1024); XMLWriter.write(out, xmlable); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); httppost.setEntity(new InputStreamEntity(in, -1)); Logger.getLogger(WebHandler.class.getName()).log(Level.INFO, "Xmlifier posting to " + bookkeepr.getConfig().getExternalUrl() + remotePath); httpclient = bookkeepr.checkoutHttpClient(); HttpResponse httpresp = httpclient.execute(httppost); for (Header head : httpresp.getAllHeaders()) { if (head.getName().equalsIgnoreCase("transfer-encoding")) { continue; } response.setHeader(head.getName(), head.getValue()); } response.setStatus(httpresp.getStatusLine().getStatusCode()); httpresp.getEntity().writeTo(response.getOutputStream()); } catch (HttpException ex) { Logger.getLogger(WebHandler.class.getName()).log(Level.WARNING, "HttpException " + ex.getMessage(), ex); response.sendError(500, ex.getMessage()); } catch (URISyntaxException ex) { Logger.getLogger(WebHandler.class.getName()).log(Level.WARNING, ex.getMessage(), ex); response.sendError(400, "Invalid target URI"); } finally { if (httpclient != null) { bookkeepr.returnHttpClient(httpclient); } } } return; } if (request.getMethod().equals("GET")) { if (path.startsWith("/web")) { ((Request) request).setHandled(true); if (badchar.matcher(path).matches()) { response.sendError(400, "User Error"); return; } String localpath = path.substring(4); Logger.getLogger(WebHandler.class.getName()).log(Level.FINE, "Transmitting " + localroot + localpath); File targetFile = new File(localroot + localpath); if (targetFile.isDirectory()) { if (path.endsWith("/")) { targetFile = new File(localroot + localpath + "index.html"); } else { response.sendRedirect(path + "/"); return; } } if (targetFile.exists()) { if (targetFile.getName().endsWith(".html") || targetFile.getName().endsWith(".xsl")) { BufferedReader in = new BufferedReader(new FileReader(targetFile)); PrintStream out = null; String hdr = request.getHeader("Accept-Encoding"); if (hdr != null && hdr.contains("gzip")) { // if the host supports gzip encoding, gzip the output for quick transfer speed. out = new PrintStream(new GZIPOutputStream(response.getOutputStream())); response.setHeader("Content-Encoding", "gzip"); } else { out = new PrintStream(response.getOutputStream()); } String line = in.readLine(); while (line != null) { if (line.trim().startsWith("%%%")) { BufferedReader wrapper = new BufferedReader( new FileReader(localroot + "/wrap/" + line.trim().substring(3) + ".html")); String line2 = wrapper.readLine(); while (line2 != null) { out.println(line2); line2 = wrapper.readLine(); } wrapper.close(); } else if (line.trim().startsWith("***chooser")) { String[] elems = line.trim().split("\\s"); try { int type = TypeIdManager .getTypeFromClass(Class.forName("bookkeepr.xmlable." + elems[1])); List<IdAble> items = this.bookkeepr.getMasterDatabaseManager() .getAllOfType(type); out.printf("<select name='%sId'>\n", elems[1]); for (IdAble item : items) { out.printf("<option value='%x'>%s</option>", item.getId(), item.toString()); } out.println("</select>"); } catch (Exception e) { Logger.getLogger(WebHandler.class.getName()).log(Level.WARNING, "Could not make a type ID for " + line.trim()); } } else { out.println(line); } line = in.readLine(); } in.close(); out.close(); } else { outputToInput(new FileInputStream(targetFile), response.getOutputStream()); } } else { response.sendError(HttpStatus.SC_NOT_FOUND); } } } }
From source file:com.struts2ext.json.JSONUtil.java
public static void writeJSONToResponse(SerializationParams serializationParams) throws IOException { StringBuilder stringBuilder = new StringBuilder(); if (StringUtils.isNotBlank(serializationParams.getSerializedJSON())) stringBuilder.append(serializationParams.getSerializedJSON()); if (StringUtils.isNotBlank(serializationParams.getWrapPrefix())) stringBuilder.insert(0, serializationParams.getWrapPrefix()); else if (serializationParams.isWrapWithComments()) { stringBuilder.insert(0, "/* "); stringBuilder.append(" */"); } else if (serializationParams.isPrefix()) stringBuilder.insert(0, "{}&& "); if (StringUtils.isNotBlank(serializationParams.getWrapSuffix())) stringBuilder.append(serializationParams.getWrapSuffix()); String json = stringBuilder.toString(); if (LOG.isDebugEnabled()) { LOG.debug("[JSON]" + json); }/*w w w.j a v a 2s. com*/ HttpServletResponse response = serializationParams.getResponse(); // status or error code if (serializationParams.getStatusCode() > 0) response.setStatus(serializationParams.getStatusCode()); else if (serializationParams.getErrorCode() > 0) response.sendError(serializationParams.getErrorCode()); // content type if (serializationParams.isSmd()) response.setContentType("application/json-rpc;charset=" + serializationParams.getEncoding()); else response.setContentType( serializationParams.getContentType() + ";charset=" + serializationParams.getEncoding()); if (serializationParams.isNoCache()) { response.setHeader("Cache-Control", "no-cache"); response.setHeader("Expires", "0"); response.setHeader("Pragma", "No-cache"); } if (serializationParams.isGzip()) { response.addHeader("Content-Encoding", "gzip"); GZIPOutputStream out = null; InputStream in = null; try { out = new GZIPOutputStream(response.getOutputStream()); in = new ByteArrayInputStream(json.getBytes(serializationParams.getEncoding())); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } } finally { if (in != null) in.close(); if (out != null) { out.finish(); out.close(); } } } else { response.setContentLength(json.getBytes(serializationParams.getEncoding()).length); PrintWriter out = response.getWriter(); out.print(json); } }
From source file:com.github.jasonruckman.gzip.AbstractBenchmark.java
protected byte[] doWriteKryo() { try {//w ww .j a v a 2s .c o m ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = new GZIPOutputStream(baos); Output output = output(); output.setOutputStream(gzos); kryo().writeObject(output, sampleData); output.close(); gzos.close(); return baos.toByteArray(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:chibi.gemmaanalysis.ExperimentMetaDataExtractorCli.java
public void generateExperimentMetaData(Collection<BioAssaySet> expressionExperiments) throws IOException { File file = getOutputFile(this.viewFile); try (Writer writer = new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(file)));) { String[] colNames = { "ShortName", "Taxon", "DateUpload", "IsPublic", "NumPlatform", "Platform", "Channel", "IsExonArray", "QtIsRatio", "QtIsNormalized", "QtScale", "NumProfiles", "NumFilteredProfiles", "NumSamples", "NumConditions", "NumReplicatesPerCondition", "PossibleOutliers", "CuratedOutlier", "IsTroubled", "PubTroubled", "PubYear", "PubJournal", "Batch.PC1.Var", "Batch.PC2.Var", "Batch.PC3.Var", "Batch.PC1.Pval", "Batch.PC2.Pval", "Batch.PC3.Pval", "NumFactors", "FactorNames", "FactorCategories", "NumFactorValues" }; // log.info( StringUtils.join( colNames, "\t" ) + "\n" ); writer.write(StringUtils.join(colNames, "\t") + "\n"); int i = 0; Collection<String> failedEEs = new ArrayList<>(); StopWatch timer = new StopWatch(); timer.start();/*from w w w. ja v a2 s . co m*/ for (BioAssaySet bas : expressionExperiments) { /* * Skip subsets */ if (bas instanceof ExpressionExperimentSubSet) return; try { ExpressionExperiment ee = (ExpressionExperiment) bas; ee = eeService.thawLite(ee); ExpressionExperimentValueObject vo = eeService.loadValueObject(ee.getId()); vo.setIsPublic(!securityService.isPrivate(ee)); log.info("Processing (" + ++i + "/" + expressionExperiments.size() + ") : " + ee); BibliographicReference primaryPublication = ee.getPrimaryPublication(); Status pubStatus = primaryPublication != null ? statusService.getStatus(primaryPublication) : null; Collection<ArrayDesign> arrayDesignsUsed = eeService.getArrayDesignsUsed(ee); Collection<String> arrayDesignIsExon = new ArrayList<>(); Collection<String> arrayDesignTechTypes = new ArrayList<>(); Collection<String> arrayDesignShortNames = new ArrayList<>(); // for multiple platforms e.g. GSE5949 for (ArrayDesign ad : arrayDesignsUsed) { arrayDesignShortNames.add(ad.getShortName()); arrayDesignTechTypes.add(ad.getTechnologyType().getValue()); arrayDesignIsExon.add(ad.getName().toLowerCase().contains("exon") + ""); } QuantitationType qt = null; for (QuantitationType q : ee.getQuantitationTypes()) { if (q.getIsPreferred().booleanValue()) { qt = q; break; } } int manualOutlierCount = 0; for (BioAssay ba : ee.getBioAssays()) { if (ba.getIsOutlier().booleanValue()) { manualOutlierCount++; } } ExperimentalDesign experimentalDesign = edService.load(vo.getExperimentalDesign()); // Batch PCs int maxcomp = 3; BatchEffectDetails batchEffectPC1 = null; BatchEffectDetails batchEffectPC2 = null; BatchEffectDetails batchEffectPC3 = null; Collection<BatchEffectDetails> batchEffects = getBatchEffect(ee, maxcomp); Iterator<BatchEffectDetails> batchEffectsIterator; if (batchEffects == null || batchEffects.size() == 0) { log.warn("No batch effect info"); } else { batchEffectsIterator = batchEffects.iterator(); if (batchEffectsIterator.hasNext()) { batchEffectPC1 = batchEffectsIterator.next(); } if (batchEffectsIterator.hasNext()) { batchEffectPC2 = batchEffectsIterator.next(); } if (batchEffectsIterator.hasNext()) { batchEffectPC3 = batchEffectsIterator.next(); } } // eeService.getExperimentsWithOutliers(); StopWatch timerOutlier = new StopWatch(); timerOutlier.start(); // log.info( "Outlier detection service started " + timer.getTime() + "ms" ); Collection<OutlierDetails> possibleOutliers = outlierDetectionService.identifyOutliers(ee); if (timerOutlier.getTime() > 10000) { log.info("Automatic outlier detection took " + timerOutlier.getTime() + "ms"); } // Collection<OutlierDetails> possibleOutliers = null; // samples per condition boolean removeBatchFactor = false; Collection<String> samplesPerConditionCount = new ArrayList<>(); CountingMap<FactorValueVector> assayCount = ExperimentalDesignUtils.getDesignMatrix(ee, removeBatchFactor); List<FactorValueVector> keys = assayCount.sortedKeyList(true); for (FactorValueVector key : keys) { samplesPerConditionCount.add(Integer.toString(assayCount.get(key).intValue())); } // factor names Collection<ExperimentalFactor> factors = ee.getExperimentalDesign().getExperimentalFactors(); Collection<String> factorNames = new ArrayList<>(); Collection<String> factorCategories = new ArrayList<>(); Collection<Integer> factorValues = new ArrayList<>(); for (ExperimentalFactor f : factors) { factorNames.add(f.getName()); String cat = f.getCategory() != null ? f.getCategory().getCategory() : NA; factorCategories.add(cat); factorValues.add(Integer.valueOf(f.getFactorValues().size())); } int filteredProfilesCount = -1; try { FilterConfig filterConfig = new FilterConfig(); filterConfig.setIgnoreMinimumSampleThreshold(true); filteredProfilesCount = expressionDataMatrixService.getFilteredMatrix(ee, filterConfig, expressionDataMatrixService.getProcessedExpressionDataVectors(ee)).rows(); } catch (Exception e) { log.error(e.getMessage(), e); } String val[] = { vo.getShortName(), vo.getTaxon(), DateFormat.getDateInstance(DateFormat.MEDIUM).format(vo.getDateCreated()), vo != null ? Boolean.toString(vo.getIsPublic()) : NA, Integer.toString(arrayDesignsUsed.size()), StringUtils.join(arrayDesignShortNames, ','), StringUtils.join(arrayDesignTechTypes, ','), // arrayDesign.getTechnologyType().getValue(), // ONE-COLOR, TWO-COLOR, NONE (RNA-seq // GSE37646), DUAL-MODE (one or two color) StringUtils.join(arrayDesignIsExon, ','), // exon GSE28383 qt != null ? Boolean.toString(qt.getIsRatio().booleanValue()) : NA, qt != null ? Boolean.toString(qt.getIsNormalized().booleanValue()) : NA, qt != null ? qt.getScale().getValue() : NA, Integer.toString(vo.getProcessedExpressionVectorCount().intValue()), // NumProfiles Integer.toString(filteredProfilesCount), // NumFilteredProfiles Integer.toString(vo.getBioAssayCount().intValue()), // NumSamples Integer.toString(assayCount.size()), // NumConditions StringUtils.join(samplesPerConditionCount, ","), possibleOutliers != null ? Integer.toString(possibleOutliers.size()) : NA, Integer.toString(manualOutlierCount), Boolean.toString(vo.getTroubled()), pubStatus != null ? Boolean.toString(pubStatus.getTroubled().booleanValue()) : NA, primaryPublication != null ? DateFormat.getDateInstance(DateFormat.MEDIUM) .format(primaryPublication.getPublicationDate()) : NA, primaryPublication != null ? primaryPublication.getPublication() : NA, batchEffectPC1 != null ? Double.toString(batchEffectPC1.getComponentVarianceProportion()) : NA, batchEffectPC2 != null ? Double.toString(batchEffectPC2.getComponentVarianceProportion()) : NA, batchEffectPC3 != null ? Double.toString(batchEffectPC3.getComponentVarianceProportion()) : NA, batchEffectPC1 != null ? Double.toString(batchEffectPC1.getPvalue()) : NA, batchEffectPC2 != null ? Double.toString(batchEffectPC2.getPvalue()) : NA, batchEffectPC3 != null ? Double.toString(batchEffectPC3.getPvalue()) : NA, // factors factors != null ? Integer.toString(factors.size()) : NA, // NumFactors factorNames != null ? StringUtils.join(factorNames, ",") : NA, factorCategories != null ? StringUtils.join(factorCategories, ",") : NA, factorValues != null ? StringUtils.join(factorValues, ",") : NA, }; // log.info( StringUtils.join( val, "\t" ) + "\n" ); writer.write(StringUtils.join(val, "\t") + "\n"); } catch (Exception e) { failedEEs.add(((ExpressionExperiment) bas).getShortName()); StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); log.error(sw.toString()); } } log.info("Finished processing " + expressionExperiments.size() + " datasets in " + timer.getTime() + " ms. "); log.info("Writen to " + file); log.info("Number of failed experiment metadata extraction(s): " + failedEEs.size() + " / " + expressionExperiments.size()); if (failedEEs.size() > 0) { log.info("Skipped experiments:"); log.info(StringUtils.join(failedEEs, ",")); } } }
From source file:playground.christoph.evacuation.analysis.AgentsInMunicipalityEventsHandler.java
public void beforeEventsReading() { try {//from w w w. j a v a 2 s .com fos = new FileOutputStream(outputFile + ".txt.gz"); gzos = new GZIPOutputStream(fos); osw = new OutputStreamWriter(gzos, charset); bw = new BufferedWriter(osw); // write header bw.write("time"); bw.write(separator); bw.write("total inside area"); bw.write(separator); bw.write("residents inside area"); bw.write(separator); bw.write("commuters inside area"); bw.write(newLine); // write statistics before first event printStatistics(); } catch (IOException e) { throw new RuntimeException(e); } }