Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer.slice()


                encoded.writeByte(127);
                encoded.writeInt(length);
            }

            encoded.writeBytes(data, data.readerIndex(), data.readableBytes());
            encoded = encoded.slice(0, encoded.writerIndex());
            return encoded;
        }
        return msg;
    }
}
View Full Code Here


  public ChannelBuffer getMessage(MessageEvent e)
  {
    if (checkMessage(e))
    {
      ChannelBuffer m = (ChannelBuffer) e.getMessage();
      return m.slice(id.length, m.readableBytes()-id.length);
    }
    return null;
  }
 
  public String getStringMessage(MessageEvent e)
View Full Code Here

                int contentLength = content.readableBytes();

                return wrappedBuffer(
                        copiedBuffer(Integer.toHexString(contentLength), "ASCII"),
                        wrappedBuffer(CRLF),
                        content.slice(content.readerIndex(), contentLength),
                        wrappedBuffer(CRLF));
            }
        }

        // Unknown message type.
View Full Code Here

        if (d < len) {
            encode3to4(src, d + off, len - d, dest, e, dialect);
            e += 4;
        } // end if: some padding needed

        return dest.slice(0, e);
    }

    private static void encode3to4(
            ChannelBuffer src, int srcOffset, int numSigBytes,
            ChannelBuffer dest, int destOffset, Base64Dialect dialect) {
View Full Code Here

                        "bad Base64 input character at " + i + ": " +
                        src.getUnsignedByte(i) + " (decimal)");
            }
        }

        return dest.slice(0, outBuffPosn);
    }

    private static int decode4to3(
            byte[] src, int srcOffset,
            ChannelBuffer dest, int destOffset, Base64Dialect dialect) {
View Full Code Here

                int contentLength = content.readableBytes();

                return wrappedBuffer(
                        copiedBuffer(Integer.toHexString(contentLength), "ASCII"),
                        wrappedBuffer(CRLF),
                        content.slice(content.readerIndex(), contentLength),
                        wrappedBuffer(CRLF));
            }
        }

        // Unknown message type.
View Full Code Here

        }
        this.delimiters = new ChannelBuffer[delimiters.length];
        for (int i = 0; i < delimiters.length; i ++) {
            ChannelBuffer d = delimiters[i];
            validateDelimiter(d);
            this.delimiters[i] = d.slice(d.readerIndex(), d.readableBytes());
        }
        this.maxFrameLength = maxFrameLength;
    }

    @Override
View Full Code Here

                    return wrappedBuffer(
                            copiedBuffer(
                                    Integer.toHexString(contentLength),
                                    CharsetUtil.US_ASCII),
                            wrappedBuffer(CRLF),
                            content.slice(content.readerIndex(), contentLength),
                            wrappedBuffer(CRLF));
                }
            } else {
                return chunk.getContent();
            }
View Full Code Here

                int contentLength = content.readableBytes();

                return wrappedBuffer(
                        copiedBuffer(Integer.toHexString(contentLength), "ASCII"),
                        wrappedBuffer(CRLF),
                        content.slice(content.readerIndex(), contentLength),
                        wrappedBuffer(CRLF));
            }
        }

        // Unknown message type.
View Full Code Here

        if (d < len) {
            encode3to4(src, d + off, len - d, dest, e, dialect);
            e += 4;
        } // end if: some padding needed

        return dest.slice(0, e);
    }

    private static void encode3to4(
            ChannelBuffer src, int srcOffset, int numSigBytes,
            ChannelBuffer dest, int destOffset, Base64Dialect dialect) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.