org.apache.flink.util.IOUtils类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(180)

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

IOUtils介绍

[英]An utility class for I/O related functionality.
[中]用于I/O相关功能的实用程序类。

代码示例

代码示例来源:origin: apache/flink

@Override
  public void close() {
    IOUtils.closeQuietly(currentOut);
  }
}

代码示例来源:origin: apache/flink

/**
 * Copies from one stream to another. <strong>closes the input and output
 * streams at the end</strong>.
 *
 * @param in
 *        InputStream to read from
 * @param out
 *        OutputStream to write to
 * @throws IOException
 *         thrown if an I/O error occurs while copying
 */
public static void copyBytes(final InputStream in, final OutputStream out) throws IOException {
  copyBytes(in, out, BLOCKSIZE, true);
}

代码示例来源:origin: apache/flink

@Override
  public void close() {
    IOUtils.closeQuietly(currentSubIterator);
    currentSubIterator = null;

    IOUtils.closeAllQuietly(heap);
    heap.clear();
  }
}

代码示例来源:origin: apache/flink

@Override
public void close() throws IOException {
  Collection<Closeable> toCloseCopy;
  synchronized (getSynchronizationLock()) {
    if (closed) {
      return;
    }
    closed = true;
    toCloseCopy = new ArrayList<>(closeableToRef.keySet());
    closeableToRef.clear();
  }
  IOUtils.closeAllQuietly(toCloseCopy);
}

代码示例来源:origin: apache/flink

/**
 * Closes the stream ignoring {@link IOException}. Must only be called in
 * cleaning up from exception handlers.
 *
 * @param stream
 *        the stream to close
 */
public static void closeStream(final java.io.Closeable stream) {
  cleanup(null, stream);
}

代码示例来源:origin: apache/flink

@Override
  public void cancel() {
    isRunning = false;

    // we need to close the socket as well, because the Thread.interrupt() function will
    // not wake the thread in the socketStream.read() method when blocked.
    Socket theSocket = this.currentSocket;
    if (theSocket != null) {
      IOUtils.closeSocket(theSocket);
    }
  }
}

代码示例来源:origin: king/bravo

@Override
public void close() throws IOException {
  IOUtils.closeAllQuietly(iterators);
  iterators.clear();
}

代码示例来源:origin: com.alibaba.blink/flink-core

/**
 * Closes the stream ignoring {@link IOException}. Must only be called in
 * cleaning up from exception handlers.
 *
 * @param stream
 *        the stream to close
 */
public static void closeStream(final java.io.Closeable stream) {
  cleanup(null, stream);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

@Override
  public void cancel() {
    isRunning = false;

    // we need to close the socket as well, because the Thread.interrupt() function will
    // not wake the thread in the socketStream.read() method when blocked.
    Socket theSocket = this.currentSocket;
    if (theSocket != null) {
      IOUtils.closeSocket(theSocket);
    }
  }
}

代码示例来源:origin: apache/flink

void dispose() {
  // we can suppress exceptions here, because we do not rely on close() to
  // flush or persist any data
  IOUtils.closeQuietly(currentPartStream);
}

代码示例来源:origin: king/bravo

@Override
public void close() throws IOException {
  IOUtils.closeQuietly(cancelStreamRegistry);
  IOUtils.closeAllQuietly(stateColumnFamilyHandles);
  IOUtils.closeQuietly(db);
  IOUtils.closeQuietly(dbOptions);
  IOUtils.closeQuietly(colOptions);
  FileUtils.deleteDirectoryQuietly(new File(localPath));
}

代码示例来源:origin: apache/flink

/**
 * Copies from one stream to another.
 *
 * @param in
 *        InputStream to read from
 * @param out
 *        OutputStream to write to
 * @param close
 *        whether or not close the InputStream and OutputStream at the
 *        end. The streams are closed in the finally clause.
 * @throws IOException
 *         thrown if an I/O error occurs while copying
 */
public static void copyBytes(final InputStream in, final OutputStream out, final boolean close) throws IOException {
  copyBytes(in, out, BLOCKSIZE, close);
}

代码示例来源:origin: org.apache.flink/flink-core

@Override
public void close() throws IOException {
  Collection<Closeable> toCloseCopy;
  synchronized (getSynchronizationLock()) {
    if (closed) {
      return;
    }
    closed = true;
    toCloseCopy = new ArrayList<>(closeableToRef.keySet());
    closeableToRef.clear();
  }
  IOUtils.closeAllQuietly(toCloseCopy);
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Closes the stream ignoring {@link IOException}. Must only be called in
 * cleaning up from exception handlers.
 *
 * @param stream
 *        the stream to close
 */
public static void closeStream(final java.io.Closeable stream) {
  cleanup(null, stream);
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

@Override
  public void cancel() {
    isRunning = false;

    // we need to close the socket as well, because the Thread.interrupt() function will
    // not wake the thread in the socketStream.read() method when blocked.
    Socket theSocket = this.currentSocket;
    if (theSocket != null) {
      IOUtils.closeSocket(theSocket);
    }
  }
}

代码示例来源:origin: apache/flink

public void closeStream() {
  if (!closed) {
    IOUtils.closeQuietly(stream);
    closed = true;
  }
}

代码示例来源:origin: org.apache.flink/flink-statebackend-rocksdb_2.10

@Override
  public void close() {
    IOUtils.closeQuietly(currentSubIterator);
    currentSubIterator = null;
    IOUtils.closeAllQuietly(heap);
    heap.clear();
  }
}

代码示例来源:origin: apache/flink

private static void internalCopyFile(Path sourcePath, Path targetPath, boolean executable, FileSystem sFS, FileSystem tFS) throws IOException {
  try (FSDataOutputStream lfsOutput = tFS.create(targetPath, FileSystem.WriteMode.NO_OVERWRITE); FSDataInputStream fsInput = sFS.open(sourcePath)) {
    IOUtils.copyBytes(fsInput, lfsOutput);
    //noinspection ResultOfMethodCallIgnored
    new File(targetPath.toString()).setExecutable(executable);
  }
}

代码示例来源:origin: com.alibaba.blink/flink-core

@Override
public void close() throws IOException {
  Collection<Closeable> toCloseCopy;
  synchronized (getSynchronizationLock()) {
    if (closed) {
      return;
    }
    closed = true;
    toCloseCopy = new ArrayList<>(closeableToRef.keySet());
    closeableToRef.clear();
  }
  IOUtils.closeAllQuietly(toCloseCopy);
}

代码示例来源:origin: org.apache.pulsar/pulsar-flink

@Override
public void close() throws Exception {
  super.close();
  IOUtils.cleanup(LOG, consumer);
  IOUtils.cleanup(LOG, client);
}

相关文章