@Test public void shouldReadInt() throws Exception { Channel channel = new Channel( new byte[] {0x01, 0x02, 0x03, 0x04, ':'}, 1 ); EventConsumerThread thread = new EventConsumerThread( "t", channel, new MockEventHandler<Event>(), COUNTDOWN_CLOSEABLE, new MockForkNodeArguments() ); Memento memento = thread.new Memento(); memento.bb.position( 0 ).limit( 0 ); assertThat( thread.readInt( memento ) ) .isEqualTo( new BigInteger( new byte[] {0x01, 0x02, 0x03, 0x04} ).intValue() ); }
protected int readInt( Memento memento ) throws IOException, MalformedFrameException { read( memento, INT_LENGTH + DELIMITER_LENGTH ); int i = memento.bb.getInt(); checkDelimiter( memento ); return i; }
EventConsumerThread extends CloseableDaemonThread { protected int readInt( Memento memento ) throws IOException, MalformedFrameException { read( memento, INT_LENGTH + DELIMITER_LENGTH ); int i = memento.bb.getInt(); checkDelimiter( memento ); return i; } }
EventConsumerThread extends CloseableDaemonThread { protected int readInt( Memento memento ) throws IOException, MalformedFrameException { read( memento, INT_LENGTH + DELIMITER_LENGTH ); int i = memento.bb.getInt(); checkDelimiter( memento ); return i; } EventConsumerThread( @Nonnull String threadName,
                                @Nonnull ReadableByteChannel channel,
                                @Nonnull EventHandler<Event> eventHandler,
                                @Nonnull CountdownCloseable countdownCloseable,
                                @Nonnull ForkNodeArguments arguments ); }
EventConsumerThread extends CloseableDaemonThread { protected int readInt( Memento memento ) throws IOException, MalformedFrameException { read( memento, INT_LENGTH + DELIMITER_LENGTH ); int i = memento.bb.getInt(); checkDelimiter( memento ); return i; } EventConsumerThread( @Nonnull String threadName,
                                @Nonnull ReadableByteChannel channel,
                                @Nonnull EventHandler<Event> eventHandler,
                                @Nonnull CountdownCloseable countdownCloseable,
                                @Nonnull ForkNodeArguments arguments ); @Override void run(); @Override void disable(); @Override void close(); }
EventConsumerThread extends CloseableDaemonThread { protected int readInt( Memento memento ) throws IOException, MalformedFrameException { read( memento, INT_LENGTH + DELIMITER_LENGTH ); int i = memento.bb.getInt(); checkDelimiter( memento ); return i; } EventConsumerThread( @Nonnull String threadName,
                                @Nonnull ReadableByteChannel channel,
                                @Nonnull EventHandler<Event> eventHandler,
                                @Nonnull CountdownCloseable countdownCloseable,
                                @Nonnull ForkNodeArguments arguments ); @Override void run(); @Override void disable(); @Override void close();  }