java.io.FileDescriptor#out ( )源码实例Demo

下面列出了java.io.FileDescriptor#out ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: presto   文件: EnvironmentList.java
@Inject
public Execution(EnvironmentFactory factory)
{
    this.factory = requireNonNull(factory, "factory is null");

    try {
        this.out = new PrintStream(new FileOutputStream(FileDescriptor.out), true, Charset.defaultCharset().name());
    }
    catch (UnsupportedEncodingException e) {
        throw new IllegalStateException("Could not create print stream", e);
    }
}
 
源代码2 项目: mini-jvm   文件: BufferedOutputStreamTest.java
public static void main(String[] args) throws IOException {
  FileOutputStream out = new FileOutputStream(FileDescriptor.out);
  BufferedOutputStream o2 = new BufferedOutputStream(out, 1024);

  for (int i = 0; i < 10240; i++) {
    o2.write(i % 26 + 'a');
    if (i % 1024 == 0) {
      o2.write('\n');
    }
  }

  o2.flush();
  o2.close();
}
 
源代码3 项目: mini-jvm   文件: FdTest2.java
public static void main(String[] args) throws IOException {
  FileOutputStream out = new FileOutputStream(FileDescriptor.out);
  out.write('a');
  out.write('b');
  out.flush();
  out.close();
}
 
源代码4 项目: mini-jvm   文件: FdTest.java
public static void main(String[] args) throws IOException {
  FileOutputStream out = new FileOutputStream(FileDescriptor.out);
  byte[] bytes = new byte[6];
  bytes[0] = 'h';
  bytes[1] = 'e';
  bytes[2] = 'l';
  bytes[3] = 'l';
  bytes[4] = 'o';
  bytes[5] = '\n';
  out.write(bytes);
  out.flush();
  out.close();
}
 
源代码5 项目: joshua   文件: FileUtility.java
/**
 * Warning, will truncate/overwrite existing files
 * @param filename a file for which to obtain a writer
 * @return the buffered writer object
 * @throws IOException if there is a problem reading the inout file
 */
public static BufferedWriter getWriteFileStream(String filename) throws IOException {
  return new BufferedWriter(new OutputStreamWriter(
  // TODO: add GZIP
      filename.equals("-") ? new FileOutputStream(FileDescriptor.out) : new FileOutputStream(
          filename, false), StandardCharsets.UTF_8));
}
 
源代码6 项目: rtg-tools   文件: FileUtils.java
private static OutputStream javaGetStdoutAsOutputStream() {
  return new FileOutputStream(FileDescriptor.out) {
    @Override
    public void close() throws IOException {
      // Bad stuff happens if you really close stdout
      flush();
    }
  };
}
 
源代码7 项目: Bytecoder   文件: System.java
/**
 * Initialize the system class.  Called after thread initialization.
 */
private static void initPhase1() {
    // VM might invoke JNU_NewStringPlatform() to set those encoding
    // sensitive properties (user.home, user.name, boot.class.path, etc.)
    // during "props" initialization.
    // The charset is initialized in System.c and does not depend on the Properties.
    Map<String, String> tempProps = SystemProps.initProperties();
    VersionProps.init(tempProps);

    // There are certain system configurations that may be controlled by
    // VM options such as the maximum amount of direct memory and
    // Integer cache size used to support the object identity semantics
    // of autoboxing.  Typically, the library will obtain these values
    // from the properties set by the VM.  If the properties are for
    // internal implementation use only, these properties should be
    // masked from the system properties.
    //
    // Save a private copy of the system properties object that
    // can only be accessed by the internal implementation.
    VM.saveProperties(tempProps);
    props = createProperties(tempProps);

    StaticProperty.javaHome();          // Load StaticProperty to cache the property values

    lineSeparator = props.getProperty("line.separator");

    FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
    FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
    FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
    setIn0(new BufferedInputStream(fdIn));
    setOut0(newPrintStream(fdOut, props.getProperty("sun.stdout.encoding")));
    setErr0(newPrintStream(fdErr, props.getProperty("sun.stderr.encoding")));

    // Setup Java signal handlers for HUP, TERM, and INT (where available).
    Terminator.setup();

    // Initialize any miscellaneous operating system settings that need to be
    // set for the class libraries. Currently this is no-op everywhere except
    // for Windows where the process-wide error mode is set before the java.io
    // classes are used.
    VM.initializeOSEnvironment();

    // The main thread is not added to its thread group in the same
    // way as other threads; we must do it ourselves here.
    Thread current = Thread.currentThread();
    current.getThreadGroup().add(current);

    // register shared secrets
    setJavaLangAccess();

    ClassLoader.initLibraryPaths();

    // Subsystems that are invoked during initialization can invoke
    // VM.isBooted() in order to avoid doing things that should
    // wait until the VM is fully initialized. The initialization level
    // is incremented from 0 to 1 here to indicate the first phase of
    // initialization has completed.
    // IMPORTANT: Ensure that this remains the last initialization action!
    VM.initLevel(1);
}
 
源代码8 项目: openjdk-jdk9   文件: System.java
/**
 * Initialize the system class.  Called after thread initialization.
 */
private static void initPhase1() {

    // VM might invoke JNU_NewStringPlatform() to set those encoding
    // sensitive properties (user.home, user.name, boot.class.path, etc.)
    // during "props" initialization, in which it may need access, via
    // System.getProperty(), to the related system encoding property that
    // have been initialized (put into "props") at early stage of the
    // initialization. So make sure the "props" is available at the
    // very beginning of the initialization and all system properties to
    // be put into it directly.
    props = new Properties();
    initProperties(props);  // initialized by the VM

    // There are certain system configurations that may be controlled by
    // VM options such as the maximum amount of direct memory and
    // Integer cache size used to support the object identity semantics
    // of autoboxing.  Typically, the library will obtain these values
    // from the properties set by the VM.  If the properties are for
    // internal implementation use only, these properties should be
    // removed from the system properties.
    //
    // See java.lang.Integer.IntegerCache and the
    // VM.saveAndRemoveProperties method for example.
    //
    // Save a private copy of the system properties object that
    // can only be accessed by the internal implementation.  Remove
    // certain system properties that are not intended for public access.
    VM.saveAndRemoveProperties(props);

    lineSeparator = props.getProperty("line.separator");
    VersionProps.init();

    FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
    FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
    FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
    setIn0(new BufferedInputStream(fdIn));
    setOut0(newPrintStream(fdOut, props.getProperty("sun.stdout.encoding")));
    setErr0(newPrintStream(fdErr, props.getProperty("sun.stderr.encoding")));

    // Load the zip library now in order to keep java.util.zip.ZipFile
    // from trying to use itself to load this library later.
    loadLibrary("zip");

    // Setup Java signal handlers for HUP, TERM, and INT (where available).
    Terminator.setup();

    // Initialize any miscellaneous operating system settings that need to be
    // set for the class libraries. Currently this is no-op everywhere except
    // for Windows where the process-wide error mode is set before the java.io
    // classes are used.
    VM.initializeOSEnvironment();

    // The main thread is not added to its thread group in the same
    // way as other threads; we must do it ourselves here.
    Thread current = Thread.currentThread();
    current.getThreadGroup().add(current);

    // register shared secrets
    setJavaLangAccess();

    // Subsystems that are invoked during initialization can invoke
    // VM.isBooted() in order to avoid doing things that should
    // wait until the VM is fully initialized. The initialization level
    // is incremented from 0 to 1 here to indicate the first phase of
    // initialization has completed.
    // IMPORTANT: Ensure that this remains the last initialization action!
    VM.initLevel(1);
}
 
源代码9 项目: aesh-readline   文件: CygwinPty.java
@Override
public OutputStream getSlaveOutput() throws IOException {
    return new FileOutputStream(FileDescriptor.out);
}
 
源代码10 项目: aesh-readline   文件: WinSysTerminal.java
public WinSysTerminal(String name, boolean nativeSignals, SignalHandler signalHandler) throws IOException {
    super(setVTMode(), new WindowsAnsiOutputStream(new FileOutputStream(FileDescriptor.out)), name, nativeSignals, signalHandler);
}
 
源代码11 项目: codeexamples-android   文件: FileTest.java
public StubOutputStream() throws FileNotFoundException {
	super(FileDescriptor.out);
}