Parses the given file and writes its contents into the outputWriter for all logs in it.

@param inputPath
@param outputWriter
@throws IOException
516031
void parseOneFile(final Path inputPath, final Writer outputWriter) throws IOException {
    try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
      while (!scanner.atEnd()) {
        new LogFileEntry(scanner.entry()).write(outputWriter);
        scanner.advance();
      }
    }
  }
1999
public static void readAndWriteStreams(InputStream inputStream,OutputStream outputStream) throws IOException
    {
        byte[] buffer=new byte[5000];
        int read=-1;
        try
        {
            do
            {
                //read next buffer
                read=inputStream.read(buffer);
                
                if(read!=-1)
                {
                    //write to in memory stream
                    outputStream.write(buffer,0,read);
                }
            }while(read!=-1);
        }
        finally
        {
            //close streams
            IOHelper.closeResource(inputStream);
            IOHelper.closeResource(outputStream);
        }
    }
846024
protected void writeLogging(Definition def, Writer out, int indent, String level, String content, String... params)
         throws IOException
   {
      writeIndent(out, indent);
      if (def.isSupportJbossLogging())
      {
         out.write("log.trace");
         int size = params.length;
         if (size > 0)
            out.write("f");
         out.write("(\"" + content + "(");
         for (int i = 0; i < size; i++)
         {
            out.write("%s");
            if (i < size - 1)
               out.write(", ");
         }
         out.write(")\"");
         for (int i = 0; i < size; i++)
         {
            out.write(", ");
            out.write(params[i]);
         }
         out.write(");");
      }
      else
      {
         out.write("log.finest(\"" + content + "()\");");
      }
      writeEol(out);
   }
1089661
protected void writeInputData(long genbytes, Path ioPath)
      throws IOException, InterruptedException {
    final Configuration conf = getConf();
    final GridmixJob genData = new GenerateData(conf, ioPath, genbytes);
    submitter.add(genData);
    LOG.info("Generating " + StringUtils.humanReadableInt(genbytes) +
        " of test data...");
    // TODO add listeners, use for job dependencies
    TimeUnit.SECONDS.sleep(10);
    try {
      genData.getJob().waitForCompletion(false);
    } catch (ClassNotFoundException e) {
      throw new IOException("Internal error", e);
    }
    if (!genData.getJob().isSuccessful()) {
      throw new IOException("Data generation failed!");
    }
    LOG.info("Done.");
  }
785714
public void addFile(String path, InputStream inputStream, String contentType) throws IOException {
    String fullPath = buildJcrPathForZip(path);
    writeBinaryFile(fullPath, inputStream);

    if (StringUtils.isNotEmpty(contentType)) {
      String mimeType = StringUtils.substringBefore(contentType, CONTENT_TYPE_CHARSET_EXTENSION);
      String encoding = StringUtils.substringAfter(contentType, CONTENT_TYPE_CHARSET_EXTENSION);

      String fullPathMetadata = fullPath + DOT_DIR_FOLDER + "/" + DOT_CONTENT_XML;
      Document doc = xmlContentBuilder.buildNtFile(mimeType, encoding);
      writeXmlDocument(fullPathMetadata, doc);
    }
  }
427495
public Path write(Path path) throws IOException {
        write(Files.newOutputStream(path));
        return path;
    }
570403
private void writeListFile(final File inputfile, final String relativeRootFile) {
        try (Writer bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(inputfile)))) {
            bufferedWriter.write(relativeRootFile);
            bufferedWriter.flush();
        } catch (final IOException e) {
            logger.error(e.getMessage(), e) ;
        }
    }
1265577
public void write(File file) throws IOException {
        try (InputStream inputStream = getInputStream()) {
            IoUtils.copy(inputStream, file);
        }
    }
719943
public void write()
        throws IOException
    {
        BufferedWriter writer = new BufferedWriter( new OutputStreamWriter( m_outputStream ) );
        for( String line : m_content )
        {
            writer.write( line );
            writer.newLine();
        }
        writer.flush();
        writer.close();
    }
454638
public static void decompressChunks(InputStream inputStream, Path tempFileOut) throws IOException {
        try (BufferedWriter writer = Files.newBufferedWriter(tempFileOut)) {
            try (GZIPInputStream chunkZipper = new GZIPInputStream(inputStream);
                 InputStream in = new BufferedInputStream(chunkZipper);) {
                byte[] buffer = new byte[BYTES_BUFFER_SIZE];
                int len;
                while ((len = in.read(buffer)) > 0) {
                    byte[] writtenBytes = new byte[len];
                    getBytes(buffer, 0, len, writtenBytes, 0);
                    String val = new String(writtenBytes, StandardCharsets.UTF_8);
                    writer.write(val);
                }
            }
        }
    }
688350
private static void log(File logFile, long connectionId, char separator, String line) {
		synchronized(logFile) {
			try {
				try (Writer out = new FileWriter(logFile, true)) {
					out.write(Long.toString(connectionId));
					out.write(separator);
					out.write(' ');
					out.write(line);
					out.write('\n');
				}
			} catch(IOException e) {
				e.printStackTrace(System.err);
			}
		}
	}
1062022
@VisibleForTesting
  static void setFileOutputFormatOutputPath(Configuration conf, String outputPath)
      throws IOException {
    Job tempJob = new JobConfigurationAdapter(conf);
    FileOutputFormat.setOutputPath(tempJob, new Path(outputPath));
  }
761769
public void parse(InputStream inputStream) throws IOException {

		currentMatrix = null;
		currentRows = "";
		currentCols = "";
		max = Short.MIN_VALUE;
		min = Short.MAX_VALUE;
		inMatrix = false;

		BufferedReader buf = new BufferedReader (new InputStreamReader (inputStream));
		String line = null;
		line = buf.readLine();

		while (  line != null ) {

			if ( line.startsWith("//")) {
				finalizeMatrix();
				inMatrix = false;

			} else if ( line.startsWith("H ")){
				// a new matric!
				newMatrix(line);
			} else if ( line.startsWith("D ")) {
				currentMatrix.setDescription(line.substring(2));
			} else if ( line.startsWith("M ")) {
				initMatrix(line);
				inMatrix = true;
			} else if ( line.startsWith("  ")){
				if ( inMatrix)
					processScores(line);
			}

			line = buf.readLine();
		}

	}
1238489
public static void write(Path self, String text, String charset) throws IOException {
        Writer writer = null;
        try {
            writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.forName(charset));
            writer.write(text);
            writer.flush();

            Writer temp = writer;
            writer = null;
            temp.close();
        } finally {
            closeWithWarning(writer);
        }
    }
1328538
public void generateOutput(Writer outputWriter) throws IOException {
        String s = generateOutput();
        outputWriter.write(s);
    }
1324503
public void write(final Path path, final Writer<? super T> writer) {
		try {
			final File tempFile = createTempFile("__trial_meter__", ".xml");
			try {
				try (OutputStream out = new FileOutputStream(tempFile)) {
					write(out, writer);
				}

				move(tempFile.toPath(), path, REPLACE_EXISTING);
			} finally {
				deleteIfExists(tempFile.toPath());
			}
		} catch (IOException e) {
			throw new UncheckedIOException(e);
		}
	}
319079
public static void append(Path self, Object text) throws IOException {
        Writer writer = null;
        try {
            writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.defaultCharset());
            InvokerHelper.write(writer, text);
            writer.flush();

            Writer temp = writer;
            writer = null;
            temp.close();
        } finally {
            closeWithWarning(writer);
        }
    }