Create an OutputStream based on the given writable IO.
485106
public static OutputStream get(IO.Writable io) {
		if (io instanceof IOFromOutputStream)
			return ((IOFromOutputStream)io).getOutputStream();
		if (io instanceof IO.WritableByteStream)
			return new ByteStream((IO.WritableByteStream)io);
		return new Writable(io);
	}
680504
public static OutputStream newOutputStream(String path) throws IOException
    {
        if (IOAdapter == null) return new FileOutputStream(path);
        return IOAdapter.create(path);
    }
235624
public void copyToOutputStream(OutputStream o) throws IOException {
		long left = end - start;
		int BUFF_SIZE = 4096;
		byte buf[] = new byte[BUFF_SIZE];
		RandomAccessFile raf = new RandomAccessFile(file, "r");
		try {
			raf.seek(start);
			while(left > 0) {
				int amtToRead = (int) Math.min(left, BUFF_SIZE);
				int amtRead = raf.read(buf, 0, amtToRead);
				if(amtRead < 0) {
					throw new IOException("Not enough to read! EOF before expected region end");
				}
				o.write(buf,0,amtRead);
				left -= amtRead;
			}
		} finally {
			raf.close();
		}
	}
975677
def internal_writer(self, outputs, stdout):
        
        for output in outputs:
            print("\t".join(map(self.internal_serialize, output)), file=stdout)
392884
public OutputStream create(String src,
      boolean overwrite,
      short replication,
      long blockSize,
      Progressable progress,
      int buffersize
      ) throws IOException {
    return create(src, FsPermission.getDefault(),
        overwrite, replication, blockSize, progress, buffersize);
  }
1065743
private static void streamCopy(InputStream is, OutputStream os, byte[] buf, boolean close) throws IOException {
        int len;
        if (buf == null) {
            buf = new byte[4096];
        }
        while ((len = is.read(buf)) > 0) {
            os.write(buf, 0, len);
        }
        os.flush();
        if (close) {
            is.close();
        }
    }
476344
@GwtIncompatible("Unnecessary")
  private Writer streamToLegacyOutputWriter(OutputStream stream) throws IOException {
    if (legacyOutputCharset == null) {
      return new BufferedWriter(new OutputStreamWriter(stream, UTF_8));
    } else {
      return new BufferedWriter(
          new OutputStreamWriter(stream, legacyOutputCharset));
    }
  }
1227201
public void to(OutputStream outputStream) throws WriterException {
        if (!withRaw && (null == rows || rows.isEmpty())) {
            throw new WriterException("write rows cannot be empty, please check it");
        }
        if (excelType == ExcelType.XLSX) {
            new WriterWith2007(outputStream).writeSheet(this);
        }
        if (excelType == ExcelType.XLS) {
            new WriterWith2003(outputStream).writeSheet(this);
        }
        if (excelType == ExcelType.CSV) {
            new WriterWithCSV(outputStream).writeSheet(this);
        }
    }
118535
public static void writeToOutputStream(String s, OutputStream output, String encoding) throws IOException {
		BufferedReader reader = new BufferedReader(new StringReader(s));
		PrintStream writer;
		if (encoding != null) {
			writer = new PrintStream(output, true, encoding);
		}
		else {
			writer = new PrintStream(output, true);
		}
		String line;
		while ((line = reader.readLine()) != null) {
			writer.println(line);
		}
	}
579953
public OutputStream createInOutputStream(OutputStream os) {
        return new InstrumentedOutputStream(collector(), Direction.In, os, null);
    }
1356208
public static void writeObject(Object object, OutputStream outputStream) {
        try {
            if (object instanceof Compactable) {
                ((Compactable) object).compact();
            }
            defaultObjectMapper.writeValue(outputStream, object);
        } catch (IOException exp) {
            throw new RuntimeException("Failed to write object to outputstream", exp);
        }
    }
458295
private void createProcessOutputPump(InputStream is, OutputStream os) {
        outputThread = createPump(is, os, CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED);
    }
196654
public static int write(InputStream is, OutputStream os, boolean closeSink) {
        return copy(is, os, closeSink);
    }
822189
private static Writer writerFor( OutputStream stream)
    {
    try
      {
      return
        stream == null
        ? null
        : new OutputStreamWriter( stream, "UTF-8");
      }
    catch( Exception e)
      {
      throw new RuntimeException( "Can't create writer", e);
      }
    }
374894
public static void streamCopy(InputStream input, Writer output) throws IOException
	{
		if (input == null)
			throw new IllegalArgumentException("Must provide something to read from");
		if (output == null)
			throw new IllegalArgumentException("Must provide something to write to");

		streamCopy(new InputStreamReader(input), output);
	}
308981
public static void setOutputStream(final OutputStream out) {
        LowLevelLogUtil.writer = new PrintWriter(Objects.requireNonNull(out), true);
    }
33061
private static synchronized FileOutputWriter createFileWriter(final TypeDefinition type, final DecompilerSettings settings)
                throws IOException
    {
        final String outputDirectory = settings.getOutputDirectory();

        final String fileName = type.getName() + settings.getLanguage().getFileExtension();
        final String packageName = type.getPackageName();

        // foo.Bar -> foo/Bar.java
        final String subDir = StringUtils.defaultIfEmpty(packageName, "").replace('.', File.separatorChar);
        final String outputPath = PathHelper.combine(outputDirectory, subDir, fileName);

        final File outputFile = new File(outputPath);
        final File parentDir = outputFile.getParentFile();

        if (parentDir != null && !parentDir.exists() && !parentDir.mkdirs())
        {
            throw new IllegalStateException("Could not create directory:" + parentDir);
        }

        if (!outputFile.exists() && !outputFile.createNewFile())
        {
            throw new IllegalStateException("Could not create output file: " + outputPath);
        }

        return new FileOutputWriter(outputFile, settings);
    }