org.jboss.netty.buffer.ChannelBufferFactory Java Examples
The following examples show how to use
org.jboss.netty.buffer.ChannelBufferFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultChannelConfig.java From simple-netty-source with Apache License 2.0 | 6 votes |
public boolean setOption(String key, Object value) { if (key == null) { throw new NullPointerException("key"); } if ("pipelineFactory".equals(key)) { setPipelineFactory((ChannelPipelineFactory) value); } else if ("connectTimeoutMillis".equals(key)) { setConnectTimeoutMillis(ConversionUtil.toInt(value)); } else if ("bufferFactory".equals(key)) { setBufferFactory((ChannelBufferFactory) value); } else { return false; } return true; }
Example #2
Source File: DefaultChannelConfig.java From android-netty with Apache License 2.0 | 6 votes |
public boolean setOption(String key, Object value) { if (key == null) { throw new NullPointerException("key"); } if ("pipelineFactory".equals(key)) { setPipelineFactory((ChannelPipelineFactory) value); } else if ("connectTimeoutMillis".equals(key)) { setConnectTimeoutMillis(ConversionUtil.toInt(value)); } else if ("bufferFactory".equals(key)) { setBufferFactory((ChannelBufferFactory) value); } else { return false; } return true; }
Example #3
Source File: ImapRequestFrameDecoderTest.java From james-project with Apache License 2.0 | 5 votes |
@Test void newCumulationBufferShouldNotThrowOnNegativeSize() { ChannelHandlerContext channelHandler = mock(ChannelHandlerContext.class); Channel channel = mock(Channel.class); ChannelConfig channelConfig = mock(ChannelConfig.class); when(channelConfig.getBufferFactory()).thenReturn(mock(ChannelBufferFactory.class)); when(channelHandler.getChannel()).thenReturn(channel); when(channel.getConfig()).thenReturn(channelConfig); when(channelHandler.getAttachment()).thenReturn(ImmutableMap.<String, Object>of(NEEDED_DATA, -1)); assertThatCode(() -> testee.newCumulationBuffer(channelHandler, 36)) .doesNotThrowAnyException(); }
Example #4
Source File: DefaultServerChannelConfig.java From simple-netty-source with Apache License 2.0 | 5 votes |
/** * Sets an individual option. You can override this method to support * additional configuration parameters. */ public boolean setOption(String key, Object value) { if (key == null) { throw new NullPointerException("key"); } if ("pipelineFactory".equals(key)) { setPipelineFactory((ChannelPipelineFactory) value); } else if ("bufferFactory".equals(key)) { setBufferFactory((ChannelBufferFactory) value); } else { return false; } return true; }
Example #5
Source File: DefaultServerChannelConfig.java From simple-netty-source with Apache License 2.0 | 5 votes |
public void setBufferFactory(ChannelBufferFactory bufferFactory) { if (bufferFactory == null) { throw new NullPointerException("bufferFactory"); } this.bufferFactory = bufferFactory; }
Example #6
Source File: HeapChannelBufferFactory.java From simple-netty-source with Apache License 2.0 | 5 votes |
public static ChannelBufferFactory getInstance(ByteOrder endianness) { if (endianness == ByteOrder.BIG_ENDIAN) { return INSTANCE_BE; } else if (endianness == ByteOrder.LITTLE_ENDIAN) { return INSTANCE_LE; } else if (endianness == null) { throw new NullPointerException("endianness"); } else { throw new IllegalStateException("Should not reach here"); } }
Example #7
Source File: ImapRequestFrameDecoderTest.java From james-project with Apache License 2.0 | 5 votes |
@Test void newCumulationBufferShouldNotThrowWhenNoAttachments() { ChannelHandlerContext channelHandler = mock(ChannelHandlerContext.class); Channel channel = mock(Channel.class); ChannelConfig channelConfig = mock(ChannelConfig.class); when(channelConfig.getBufferFactory()).thenReturn(mock(ChannelBufferFactory.class)); when(channelHandler.getChannel()).thenReturn(channel); when(channel.getConfig()).thenReturn(channelConfig); when(channelHandler.getAttachment()).thenReturn(ImmutableMap.<String, Object>of()); assertThatCode(() -> testee.newCumulationBuffer(channelHandler, 36)) .doesNotThrowAnyException(); }
Example #8
Source File: LittleEndianHeapChannelBuffer.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory factory() { return HeapChannelBufferFactory.getInstance(ByteOrder.LITTLE_ENDIAN); }
Example #9
Source File: DefaultChannelConfig.java From android-netty with Apache License 2.0 | 4 votes |
public void setBufferFactory(ChannelBufferFactory bufferFactory) { if (bufferFactory == null) { throw new NullPointerException("bufferFactory"); } this.bufferFactory = bufferFactory; }
Example #10
Source File: DefaultChannelConfig.java From android-netty with Apache License 2.0 | 4 votes |
public ChannelBufferFactory getBufferFactory() { return bufferFactory; }
Example #11
Source File: HeapChannelBufferFactory.java From simple-netty-source with Apache License 2.0 | 4 votes |
public static ChannelBufferFactory getInstance() { return INSTANCE_BE; }
Example #12
Source File: TruncatedChannelBuffer.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory factory() { return buffer.factory(); }
Example #13
Source File: SlicedChannelBuffer.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory factory() { return buffer.factory(); }
Example #14
Source File: BigEndianHeapChannelBuffer.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory factory() { return HeapChannelBufferFactory.getInstance(ByteOrder.BIG_ENDIAN); }
Example #15
Source File: CompositeChannelBuffer.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory factory() { return HeapChannelBufferFactory.getInstance(order()); }
Example #16
Source File: DuplicatedChannelBuffer.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory factory() { return buffer.factory(); }
Example #17
Source File: DefaultServerChannelConfig.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory getBufferFactory() { return bufferFactory; }
Example #18
Source File: DefaultChannelConfig.java From simple-netty-source with Apache License 2.0 | 4 votes |
public void setBufferFactory(ChannelBufferFactory bufferFactory) { if (bufferFactory == null) { throw new NullPointerException("bufferFactory"); } this.bufferFactory = bufferFactory; }
Example #19
Source File: DefaultChannelConfig.java From simple-netty-source with Apache License 2.0 | 4 votes |
public ChannelBufferFactory getBufferFactory() { return bufferFactory; }
Example #20
Source File: ChannelConfig.java From simple-netty-source with Apache License 2.0 | 2 votes |
/** * Sets the default {@link ChannelBufferFactory} used to create a new * {@link ChannelBuffer}. The default is {@link HeapChannelBufferFactory}. * You can specify a different factory to change the default * {@link ByteOrder} for example. */ void setBufferFactory(ChannelBufferFactory bufferFactory);
Example #21
Source File: ChannelConfig.java From simple-netty-source with Apache License 2.0 | 2 votes |
/** * Returns the default {@link ChannelBufferFactory} used to create a new * {@link ChannelBuffer}. The default is {@link HeapChannelBufferFactory}. * You can specify a different factory to change the default * {@link ByteOrder} for example. */ ChannelBufferFactory getBufferFactory();
Example #22
Source File: ChannelConfig.java From android-netty with Apache License 2.0 | 2 votes |
/** * Returns the default {@link ChannelBufferFactory} used to create a new * {@link ChannelBuffer}. The default is {@link HeapChannelBufferFactory}. * You can specify a different factory to change the default * {@link ByteOrder} for example. */ ChannelBufferFactory getBufferFactory();
Example #23
Source File: ChannelConfig.java From android-netty with Apache License 2.0 | 2 votes |
/** * Sets the default {@link ChannelBufferFactory} used to create a new * {@link ChannelBuffer}. The default is {@link HeapChannelBufferFactory}. * You can specify a different factory to change the default * {@link ByteOrder} for example. */ void setBufferFactory(ChannelBufferFactory bufferFactory);
Example #24
Source File: FrameDecoder.java From android-netty with Apache License 2.0 | 2 votes |
/** * Create a new {@link ChannelBuffer} which is used for the cumulation. * Sub-classes may override this. * * @param ctx * {@link ChannelHandlerContext} for this handler * @return buffer the {@link ChannelBuffer} which is used for cumulation */ protected ChannelBuffer newCumulationBuffer(ChannelHandlerContext ctx, int minimumCapacity) { ChannelBufferFactory factory = ctx.getChannel().getConfig().getBufferFactory(); return factory.getBuffer(Math.max(minimumCapacity, 256)); }