org.crsh.util.Utils.close()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(158)

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

Utils.close介绍

[英]Close the closeable and catch any exception thrown.
[中]

代码示例

代码示例来源:origin: crashub/crash

void close() {
 if (status == RUNNING) {
  status = CLOSED;
  Utils.close(driver);
 }
}

代码示例来源:origin: crashub/crash

@Override
public void close() throws IOException {
 Utils.close(nested);
 Utils.close(container);
}
@Override

代码示例来源:origin: crashub/crash

public final void close() {
  try {
   Utils.close(socket);
   Utils.close(in);
   Utils.close(out);
  }
  finally {
   this.socket = null;
   this.in = null;
   this.out = null;
  }
 }
}

代码示例来源:origin: crashub/crash

public final void close() {
  try {
   Utils.close(socket);
   Utils.close(in);
   Utils.close(out);
  }
  finally {
   this.socket = null;
   this.in = null;
   this.out = null;
  }
 }
}

代码示例来源:origin: crashub/crash

public void destroy() {
 Utils.close(console);
 thread.interrupt();
}

代码示例来源:origin: crashub/crash

public void close() {
  if (closed.compareAndSet(false, true)) {
   for (Closeable closeable : closeables) {
    log.log(Level.FINE, "Closing " + closeable.getClass().getSimpleName());
    Utils.close(closeable);
   }
  }
 }
}

代码示例来源:origin: crashub/crash

public static void copy(InputStream in, OutputStream out) throws IOException {
 if (in == null) {
  throw new NullPointerException();
 }
 try {
  byte[] buffer = new byte[256];
  for (int l = in.read(buffer); l != -1; l = in.read(buffer)) {
   out.write(buffer, 0, l);
  }
 }
 finally {
  close(in);
 }
}

代码示例来源:origin: crashub/crash

public void on(KeyStroke keyStroke) {
 //
 if (keyStroke.operation == Operation.INTERRUPT) {
  Plugin current = handler.get();
  if (current == null) {
   throw new IllegalStateException("Not initialized");
  } else if (current instanceof ProcessHandler) {
   ProcessHandler processHandler = (ProcessHandler)current;
   ProcessHandler.Reader reader = processHandler.editor.get();
   if (reader != null) {
    reader.thread.interrupt();
   }
   processHandler.process.cancel();
   return;
  }
 }
 buffer.add(keyStroke);
 //
 iterate();
 // This was modified by this thread during the loop
 if (status == CLOSING) {
  status = CLOSED;
  Utils.close(driver);
 }
}

代码示例来源:origin: crashub/crash

Utils.close(i);

代码示例来源:origin: crashub/crash

Utils.close(container);

代码示例来源:origin: crashub/crash

public void testClose() {
 Exception closed = Utils.close(new Closeable() {
  public void close() throws IOException {
 assertNull(closed);
 final IOException ioe = new IOException();
 closed = Utils.close(new Closeable() {
  public void close() throws IOException {
   throw ioe;
 assertSame(ioe, closed);
 final RuntimeException re = new RuntimeException();
 closed = Utils.close(new Closeable() {
  public void close() throws IOException {
   throw re;
 final Error thrown = new Error();
 try {
  Utils.close(new Closeable() {
   public void close() throws IOException {
    throw thrown;

代码示例来源:origin: crashub/crash

@Override
ShellResponse doInvoke(final ShellProcessContext context) throws InterruptedException {
 CRaSHProcessContext invocationContext = new CRaSHProcessContext(session, context);
 try {
  command.invoke(invocationContext);
  return ShellResponse.ok();
 }
 catch (CommandException e) {
  return build(e);
 } catch (Throwable t) {
  return build(t);
 } finally {
  Utils.close(invocationContext);
 }
}

代码示例来源:origin: crashub/crash

Utils.close(closeable);

代码示例来源:origin: crashub/crash

public SSHClient close() {
  try {
   Utils.close(out);
   channel.close(false);
   session.close(false);
   client.stop();
   return this;
  } finally {
   this.client = null;
   this.channel = null;
   this.session = null;
   this.out = null;
  }
 }
}

代码示例来源:origin: org.crashub/crash.shell

@Override
public void close() throws IOException {
 Utils.close(nested);
 Utils.close(container);
}
@Override

代码示例来源:origin: com.github.corda.crash/crash.shell

@Override
public void close() throws IOException {
 Utils.close(nested);
 Utils.close(container);
}
@Override

代码示例来源:origin: com.github.corda.crash/crash.shell

public final void close() {
  try {
   Utils.close(socket);
   Utils.close(in);
   Utils.close(out);
  }
  finally {
   this.socket = null;
   this.in = null;
   this.out = null;
  }
 }
}

代码示例来源:origin: com.github.corda.crash/crash.shell

public final void close() {
  try {
   Utils.close(socket);
   Utils.close(in);
   Utils.close(out);
  }
  finally {
   this.socket = null;
   this.in = null;
   this.out = null;
  }
 }
}

代码示例来源:origin: org.crashub/crash.shell

void close() {
 if (status == RUNNING) {
  status = CLOSED;
  Utils.close(driver);
 }
}

代码示例来源:origin: org.crashub/crash.connectors.ssh

public void destroy() {
 Utils.close(console);
 thread.interrupt();
}

相关文章