org.apache.tools.ant.util.FileUtils.close()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.tools.ant.util.FileUtils.close()方法的一些代码示例,展示了FileUtils.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.close()方法的具体详情如下:
包路径:org.apache.tools.ant.util.FileUtils
类名称:FileUtils
方法名:close

FileUtils.close介绍

[英]Close a stream without throwing any exception if something went wrong. Do not attempt to close it if the argument is null.
[中]如果出现问题,关闭流而不抛出任何异常。如果参数为null,请不要尝试关闭它。

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Notify the <code>Redirector</code> that it is now okay to set any output
 * and/or error properties.
 */
public void setProperties() {
  synchronized (outMutex) {
    FileUtils.close(baos);
  }
  synchronized (errMutex) {
    FileUtils.close(errorBaos);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Close a stream without throwing any exception if something went wrong.
 * Do not attempt to close it if the argument is null.
 *
 * @param device stream, can be null.
 */
public static void close(InputStream device) {
  close((AutoCloseable) device);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Close a Reader without throwing any exception if something went wrong.
 * Do not attempt to close it if the argument is null.
 *
 * @param device Reader, can be null.
 */
public static void close(Reader device) {
  close((AutoCloseable) device);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Close a Channel without throwing any exception if something went wrong.
 * Do not attempt to close it if the argument is null.
 *
 * @param device channel, can be null.
 * @since Ant 1.8.0
 */
public static void close(Channel device) {
  close((AutoCloseable) device);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Close logfiles, if we have been writing to them.
 *
 * @since Ant 1.6
 */
private void handleLogfile() {
  if (isLogFileUsed) {
    FileUtils.close(out);
    FileUtils.close(err);
  }
}

代码示例来源:origin: org.apache.ant/ant

void complete() {
    FileUtils.close(ps);
  }
}

代码示例来源:origin: org.apache.ant/ant

private void closeCurrent() {
    FileUtils.close(currentStream);
    currentStream = null;
  }
}

代码示例来源:origin: org.apache.ant/ant

private void closeCurrent() {
    FileUtils.close(currentStream);
    currentStream = null;
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Close a Writer without throwing any exception if something went wrong.
 * Do not attempt to close it if the argument is null.
 * @param device output writer, can be null.
 */
public static void close(Writer device) {
  close((AutoCloseable) device);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Close a stream without throwing any exception if something went wrong.
 * Do not attempt to close it if the argument is null.
 *
 * @param device stream, can be null.
 */
public static void close(OutputStream device) {
  close((AutoCloseable) device);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Close the streams belonging to the given Process.
 *
 * @param process the <code>Process</code>.
 */
public static void closeStreams(Process process) {
  FileUtils.close(process.getInputStream());
  FileUtils.close(process.getOutputStream());
  FileUtils.close(process.getErrorStream());
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Constructor used by Ant's introspection mechanism.
 * The original filter reader is only used for chaining
 * purposes, never for filtering purposes (and indeed
 * it would be useless for filtering purposes, as it has
 * no real data to filter). ChainedReaderHelper uses
 * this placeholder instance to create a chain of real filters.
 */
public BaseFilterReader() {
  super(new StringReader(""));
  FileUtils.close(this);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Resets the buffer for the current thread.
 */
private void resetBufferInfo() {
  Thread current = Thread.currentThread();
  BufferInfo bufferInfo = buffers.get(current);
  FileUtils.close(bufferInfo.buffer);
  bufferInfo.buffer = new ByteArrayOutputStream();
  bufferInfo.crSeen = false;
}

代码示例来源:origin: org.apache.ant/ant

/**
   * Closes streams, interrupts the download, may delete the
   * output file.
   */
  void closeStreams() {
    interrupt();
    FileUtils.close(os);
    FileUtils.close(is);
    if (!success && dest.exists()) {
      dest.delete();
    }
  }
}

代码示例来源:origin: org.apache.ant/ant

public void close() throws IOException {
  FileUtils.close(in);
  z.close();
}
protected void finalize() throws Throwable {

代码示例来源:origin: org.apache.ant/ant

/**
 * Set the <code>OutputStream</code> by means of which
 * input can be sent to the process.
 * @param os the <code>OutputStream</code>.
 */
public void setProcessInputStream(OutputStream os) {
  if (input != null) {
    inputThread = createPump(input, os, true, nonBlockingRead);
  } else {
    FileUtils.close(os);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Cleans up any resources held by this classloader. Any open archive
 * files are closed.
 */
public synchronized void cleanup() {
  for (final JarFile jarFile : jarFiles.values()) {
    FileUtils.close(jarFile);
  }
  jarFiles = new Hashtable<>();
  if (project != null) {
    project.removeBuildListener(this);
  }
  project = null;
}

代码示例来源:origin: org.apache.ant/ant

@Override
public void close() throws IOException {
  FileUtils.close(in);
  classLoader.cleanup();
}

代码示例来源:origin: org.apache.ant/ant

/**
   * Stop the log stream handler.
   */
  @Override
  public void stop() {
    super.stop();
    FileUtils.close(getErr());
    FileUtils.close(getOut());
  }
}

代码示例来源:origin: org.apache.ant/ant

@Override
  public void stop() {
    super.stop();
    FileUtils.close(getErr());
    FileUtils.close(getOut());
  }
}

相关文章