本文整理了Java中org.crsh.util.Utils.close()
方法的一些代码示例,展示了Utils.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.close()
方法的具体详情如下:
包路径:org.crsh.util.Utils
类名称: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();
}
内容来源于网络,如有侵权,请联系作者删除!