Commit Graph

63 Commits

Author SHA1 Message Date
Norman Maurer
b8ae8be96a Fix IndexOutOfBoundException when using CompositeChannelBuffer and the readerIndex is at the last position and an empty array is passed to read to. See #474 2012-09-22 21:23:58 +02:00
Norman Maurer
5dbb799a92 Merge pull request #554 from jfallows/composite-buffer
Prevent Unpooled.EMPTY_BUFFER from being stored in the composite buffer ...
2012-08-23 22:26:03 -07:00
John Fallows
83c21d70ee Prevent Unpooled.EMPTY_BUFFER from being stored in the composite buffer due to a zero length slice, which causes reference counting problems on subsequent discardReadBytes. 2012-08-19 22:59:49 -07:00
Trustin Lee
df0aee22cb [#540] Add a variant of ByteBuf.ensureWritableBytes() which does not throw an exception 2012-08-20 12:52:38 +09:00
Trustin Lee
aa8a761fe2 Better exception message
.. as advised by @jpinner
2012-08-20 12:30:38 +09:00
Trustin Lee
505e767a09 [#529] ByteBuf.ensureWritableBytes() can trigger IllegalArgumentException
- Remove redundant boundary check in ensureWritableBytes()
- Ensure calculateNewCapacity() never returns the value that exceeds
  maxCapacity
2012-08-17 22:08:36 +09:00
John Fallows
06fd869711 Add support for AIO scattering reads and gathering writes.
o Add ByteBuf.hasNioBuffers() method
 o Promote CompositeByteBuf.nioBuffers() methods to ByteBuf
 o Use ByteBuf.nioBuffers() methods from AioSocketChannel
2012-08-12 17:29:07 -07:00
Trustin Lee
501746aeff Fix an infinite loop in DefaultCompositeByteBuf.setBytes() 2012-08-08 17:42:58 +09:00
Trustin Lee
a2aadef4da Add ByteBuf.Unsafe.discardSomeReadBytes() to reduce discardReadBytes() 2012-08-08 17:34:00 +09:00
norman
f7e0366bae Add nioBuffers() and nioBuffers(..) method which will be used to support gathering writes for the AIO transport. See #492 2012-08-07 15:39:46 +02:00
Trustin Lee
728306b64f Add CompositeByteBuf.consolidate()
- also added test cases that test automatic / full / ranged
  consolidation
2012-08-05 18:32:30 +09:00
Trustin Lee
26e64eb305 Fix IOOBE after buffer truncation / Add CompositeByteBuf.addComponents()
- plus some bug fixes while running unit tests
2012-07-20 13:18:17 +09:00
Trustin Lee
8d813b127c Replace free() with reference counting / Fix SlicedByteBuf.unsafe()
- based on @normanmaurer's feed back
- Added Unpooled.compositeBuffer(int)
2012-07-20 12:33:17 +09:00
Trustin Lee
5a613f379e Make ByteBuf dynamic / Introduce an interface for composite buffers
- Replace ByteBufferBackedByteBuf with DirectByteBuf
- Make DirectByteBuf and HeapByteBuf dynamic
- Remove DynamicByteBuf
- Replace Unpooled.dynamicBuffer() with Unpooled.buffer() and
  directBuffer()
- Remove ByteBufFactory (will be replaced with ByteBufPool later)
- Add ByteBuf.Unsafe (might change in the future)
2012-07-19 20:25:47 +09:00
Trustin Lee
917ed5173e Fix a bug where discardReadBytes() doesn't adjust markers
.. if buffer is empty
2012-07-10 14:23:31 +09:00
Cruz Julian Bishop
b9d16663d9 Fixes javadoc from #414 / #415 (@trustin) 2012-06-30 20:30:56 +10:00
Norman Maurer
27b83a480b Fix checkstyle 2012-06-29 12:49:58 +02:00
Norman Maurer
07095a41f4 Rename method and make it more clear thats an expert method. See #414 #415 2012-06-29 12:28:08 +02:00
Cruz Julian Bishop
c52cb0ea21 Assuming that @trustin will want this changed :) 2012-06-29 19:27:41 +10:00
Cruz Julian Bishop
c55e10c12a Fix a bug where a potential overflow occurs 2012-06-29 13:38:53 +10:00
Cruz Julian Bishop
b11d4fa37a Two tentative last asserts in the test 2012-06-29 13:37:41 +10:00
Cruz Julian Bishop
557f1c85df Little bit more testing 2012-06-29 13:35:14 +10:00
Cruz Julian Bishop
3d9be81377 Provide a basic test for getBufferFor() 2012-06-29 13:31:02 +10:00
Cruz Julian Bishop
e2989719e1 Comply with line width a bit more 2012-06-28 19:34:52 +10:00
Cruz Julian Bishop
a504aa1159 Documentation and checkstyle fixes from @fredericBregier
This is part of #414
2012-06-28 19:33:54 +10:00
Cruz Julian Bishop
42f3a6750a Add documentation and changes to ComposityByteBuf.getBufferFor(index)
Thanks to @kimchy and @fredericBregier
This is part of #414
2012-06-28 19:01:16 +10:00
Cruz Julian Bishop
49f0e32428 Actually throw the correct Exception type. Whoops!
This should be done, now.
2012-06-28 10:31:49 +10:00
Cruz Julian Bishop
332a35f9ed Simplify the process of getting the component 2012-06-28 10:29:11 +10:00
Cruz Julian Bishop
cb8c9767f6 Adds a method to get the buffer for a specific index in CompositeByteBuf
This fixes #414
2012-06-28 10:24:18 +10:00
Trustin Lee
1be9bbf62c Add CompositeByteBuf.numComponents() 2012-06-24 22:14:17 +09:00
Trustin Lee
8b7af2ca3b Generate Javadoc with APIviz 2012-06-13 12:11:11 +09:00
Trustin Lee
3b562c917d Move ChannelBufferType to netty-buffers and rename it to ChannelBufType
- Also add ChannelBuf.type()
2012-06-12 17:05:28 +09:00
Trustin Lee
ecd0ae5406 Prefer MessageBuf over Queue where possible
- Also replaced thread safe queues with non-thread-safe ones where
  possible
- Unpooled.wrappedBuffer(Queue<T>) does not wrap MessageBuf anymore
2012-06-12 17:02:00 +09:00
Trustin Lee
6211e53e86 Code clean-up based on IntelliJ code analysis 2012-06-11 22:54:28 +09:00
Trustin Lee
40a7659784 Move utility methods in Unpooled to ByteBufUtil 2012-06-11 20:41:19 +09:00
Trustin Lee
754392aaa9 Add ByteBuf.order(ByteOrder) method to simplify little endian access
- Removed all methods that requires ByteOrder as a parameter
  from Unpooled (formerly ByteBufs/ChannelBuffers)
  - Instead, a user calls order(ByteOrder) to get a little endian
    version of the user's buffer
  - This gives less overwhelming number of methods in Unpooled.
2012-06-11 20:24:44 +09:00
Trustin Lee
876847fd20 Merge MessageBufs and ByteBufs into Unpooled
- e.g. Unpooled.messageBuffer()
- It will make much more sense once we introduce pooling:
  - i.e. Pooled.buffer()
2012-06-11 17:02:29 +09:00
Trustin Lee
574d84e98e Remove ChannelBufferHolder / Add more handler interfaces for type safety
- ChannelInboundHandler and ChannelOutboundHandler does not have a type
  parameter anymore.  
- User should implement ChannelInboundMessageHandler or
  ChannelOutboundMessageHandler.
2012-06-10 12:22:32 +09:00
Trustin Lee
a849d11877 ChannelBuffers -> ByteBufs / Add MessageBuf & ChannelBuf
- Add MessageBuf which replaces java.util.Queue
- Add ChannelBuf which is common type of ByteBuf and ChannelBuf
- ChannelBuffers was renamed to ByteBufs
- Add MessageBufs
- All these changes are going to replace ChannelBufferHolder.
2012-06-10 11:31:39 +09:00
Trustin Lee
5164d91255 Rename ChannelBuffer to ByteBuf as discussed before
- ChannelBuffer gives a perception that it's a buffer of a
  channel, but channel's buffer is now a byte buffer or a message
  buffer.  Therefore letting it be as is is going to be confusing.
2012-06-10 11:08:43 +09:00
Trustin Lee
468a3228a4 Fit every line into 120 columns 2012-06-08 19:28:12 +09:00
Trustin Lee
c2e65016fd Fixed some checkstyle errors 2012-06-04 13:43:02 -07:00
Trustin Lee
1eced1e9e3 Update license headers 2012-06-04 13:31:44 -07:00
Trustin Lee
cc4f705029 Replace ChannelBuffer.toByteBuffer() with hasNioBuffer() and nioBuffer()
... just like we do with byte arrays.  toByteBuffer() and
toByteBuffers() had an indeterministic behavior and thus it could not
tell when the returned NIO buffer is shared or not.  nioBuffer() always
returns a view buffer of the Netty buffer.  The only case where
hasNioBuffer() returns false and nioBuffer() fails is the
CompositeChannelBuffer, which is not very commonly used and *slow*.
2012-06-02 01:30:55 -07:00
Trustin Lee
77274ae743 Automated code clean-up 2012-05-31 12:03:01 -07:00
Trustin Lee
c8fa42beaf Rename wrapPrimitive() to copyPrimitive() / Add tests / Tidy up (#167)
- Add ChannelBuffers.copyShort(short...)
2012-05-31 11:13:01 -07:00
Trustin Lee
429535e6c8 More primitive wrapper methods (#167)
- ChannelBuffers.wrap(Float|Double)(...)
- Handle the case where there is only one value.
2012-05-31 10:51:27 -07:00
Trustin Lee
c32df371ab Fix compilation errors 2012-05-31 01:55:30 -07:00
norman
7fb64e2046 A small optimization for the fix of #360 2012-05-30 23:06:06 -07:00
Sun Ning
f2df20ddff fix #360, add check for empty buffer; also add unit test for this scenario 2012-05-30 23:05:43 -07:00