void safeHandleFinished() { try { messageHandler.handleFinished(this); } catch (IOException e) { CONNECTION_LOGGER.failedToHandleSocketFinished(e); } }
void safeHandleShutdown() { try { messageHandler.handleShutdown(this); } catch (IOException e) { CONNECTION_LOGGER.failedToHandleSocketShutdown(e); } }
void safeHandlerFailure(IOException e) { try { messageHandler.handleFailure(this, e); } catch (IOException e1) { CONNECTION_LOGGER.failedToHandleSocketFailure(e); } }
public static long readLong(final InputStream in) throws IOException { byte[] bytes = new byte[8]; readFully(in, bytes, 0, 8); return (((long)bytes[0] << 56) + ((long)(bytes[1] & 255) << 48) + ((long)(bytes[2] & 255) << 40) + ((long)(bytes[3] & 255) << 32) + ((long)(bytes[4] & 255) << 24) + ((bytes[5] & 255) << 16) + ((bytes[6] & 255) << 8) + ((bytes[7] & 255) << 0)); }
public static void expectHeader(final InputStream input, int expected) throws IOException { expectHeader(StreamUtils.readByte(input), expected); }
private void closed() { ClosedCallback callback = this.callback; if (callback != null) { callback.connectionClosed(); } } }
@Override public void restoreMessageHandler() { MessageHandler handler = backupHandler; setMessageHandler(handler == null ? MessageHandler.NULL : handler); }
@Override public void run() { safeHandleFinished(); } });
/** * {@inheritDoc} */ public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
@Override public void setMessageHandler(final MessageHandler messageHandler) { if (messageHandler == null) { throw MESSAGES.nullVar("messageHandler"); } this.messageHandler = messageHandler; }
public static void expectHeader(final byte actual, int expected) throws IOException { if (actual != (byte) expected) { throw MESSAGES.invalidByteToken(expected, actual); } } }
public static long readLong(final InputStream in) throws IOException { byte[] bytes = new byte[8]; readFully(in, bytes, 0, 8); return (((long)bytes[0] << 56) + ((long)(bytes[1] & 255) << 48) + ((long)(bytes[2] & 255) << 40) + ((long)(bytes[3] & 255) << 32) + ((long)(bytes[4] & 255) << 24) + ((bytes[5] & 255) << 16) + ((bytes[6] & 255) << 8) + ((bytes[7] & 255) << 0)); }
public static void expectHeader(final InputStream input, int expected) throws IOException { expectHeader(StreamUtils.readByte(input), expected); }
private void closed() { ClosedCallback callback = this.callback; if (callback != null) { callback.connectionClosed(); } } }
@Override public void restoreMessageHandler() { MessageHandler handler = backupHandler; setMessageHandler(handler == null ? MessageHandler.NULL : handler); }
@Override public void run() { safeHandleFinished(); } });
public static long readLong(final InputStream in) throws IOException { byte[] bytes = new byte[8]; readFully(in, bytes, 0, 8); return (((long)bytes[0] << 56) + ((long)(bytes[1] & 255) << 48) + ((long)(bytes[2] & 255) << 40) + ((long)(bytes[3] & 255) << 32) + ((long)(bytes[4] & 255) << 24) + ((bytes[5] & 255) << 16) + ((bytes[6] & 255) << 8) + ((bytes[7] & 255) << 0)); }
public static void expectHeader(final InputStream input, int expected) throws IOException { expectHeader(StreamUtils.readByte(input), expected); }
private void closed() { ClosedCallback callback = this.callback; if (callback != null) { callback.connectionClosed(); } } }