Java Text File Write nio write(final OutputStream outputStream, final String string)

Here you can find the source of write(final OutputStream outputStream, final String string)

Description

write

License

Apache License

Parameter

Parameter Description
outputStream a parameter
string a parameter

Declaration

static final void write(final OutputStream outputStream, final String string) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;

import java.io.OutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class Main {
    static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;

    /**//from   w  w  w . java  2  s  .  c o  m
     * @param outputStream
     * @param string
     */
    static final void write(final OutputStream outputStream, final String string) throws IOException {
        write(outputStream, string.getBytes(DEFAULT_CHARSET));
    }

    /**
     * @param outputStream
     * @param data
     */
    static final void write(final OutputStream outputStream, final byte[] data) throws IOException {
        outputStream.write(data);
    }
}

Related

  1. write(File file, List lines, StandardOpenOption... options)
  2. write(File file, String content)
  3. write(File file, String data, boolean append)
  4. write(final Map dataBase, final File currentFile)
  5. write(final Object o, final String filename)
  6. write(final StringBuffer data, final Writer output)
  7. write(OutputStream stream, String string)
  8. write(String content, String file)
  9. write(String location, String content)