Package org.jboss.netty.buffer

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


            ChannelBuffer buffer = embedder.poll();
            if (buffer == null) {
                break;
            }
            while (buffer.readable()) {
                assertEquals(BYTES[i++], buffer.readByte());
                read++;
                if (i == BYTES.length) {
                    i = 0;
                }
            }
View Full Code Here


   * Creates a new {@link RegionInfo} from a pre-0.95 META {@link KeyValue}.
   */
  private static RegionInfo
  deserializeOldRegionInfo(final KeyValue kv, final byte[][] out_start_key) {
    final ChannelBuffer buf = ChannelBuffers.wrappedBuffer(kv.value());
    buf.readByte(); // Skip the version.
    // version 1 was introduced in HBase 0.92 (see HBASE-451).
    // The differences between v0 and v1 are irrelevant to us,
    // as we only look at the first few fields, and they didn't
    // change across these 2 versions.
    final byte[] stop_key = HBaseRpc.readByteArray(buf);
View Full Code Here

    // version 1 was introduced in HBase 0.92 (see HBASE-451).
    // The differences between v0 and v1 are irrelevant to us,
    // as we only look at the first few fields, and they didn't
    // change across these 2 versions.
    final byte[] stop_key = HBaseRpc.readByteArray(buf);
    final boolean offline = buf.readByte() != 0;
    final long region_id = buf.readLong();
    final byte[] region_name = HBaseRpc.readByteArray(buf);
    // TODO(tsuna): Can we easily de-dup this array with another RegionInfo?
    byte[] table;
    try {
View Full Code Here

      table = tableFromRegionName(region_name);
    } catch (IllegalArgumentException e) {
      throw BrokenMetaException.badKV(null, "an `info:regioninfo' cell"
                                      + " has a " + e.getMessage(), kv);
    }
    final boolean split = buf.readByte() != 0;
    final byte[] start_key = HBaseRpc.readByteArray(buf);
    // Table description and hash code are left, but we don't care.

    if (LOG.isDebugEnabled()) {
      LOG.debug("Got " + Bytes.pretty(table) + "'s region ["
View Full Code Here

      int to = buf.writerIndex();
      int index = 0;
      boolean flag = false;

      for (int i = from; i < to; i++) {
        byte b = buf.readByte();

        if (b == separator) {
          break;
        }
View Full Code Here

        if (c > 127) {
          flag = true;
        }

        if (c == '\\' && i + 1 < to) {
          byte b2 = buf.readByte();

          if (b2 == 't') {
            c = '\t';
            i++;
          } else if (b2 == 'r') {
View Full Code Here

        // netty always copies a buffer, either in NioWorker in its read handler, where it copies to a fresh
        // buffer, or in the cumlation buffer, which is cleaned each time
        StreamInput streamIn = ChannelBufferStreamInputFactory.create(buffer, size);

        long requestId = buffer.readLong();
        byte status = buffer.readByte();
        Version version = Version.fromId(buffer.readInt());

        // !!! compression handling removed !!!
        StreamInput wrappedStream = CachedStreamInput.cachedHandles(streamIn);
View Full Code Here

  @Test
  public void testControlCharacterSkipping() {
    ChannelBuffer buffer = ChannelBuffers.copiedBuffer("  TESTLINE".getBytes());
    IcapDecoderUtil.skipControlCharacters(buffer);
    assertEquals("skipping of whitespaces has not worked",'T',(char)buffer.readByte());
  }
 
  @Test
  public void testSkipControlCharacter() {
    ChannelBuffer buffer = ChannelBuffers.copiedBuffer(new byte[]{0x0001,'A'});
View Full Code Here

 
  @Test
  public void testSkipControlCharacter() {
    ChannelBuffer buffer = ChannelBuffers.copiedBuffer(new byte[]{0x0001,'A'});
    IcapDecoderUtil.skipControlCharacters(buffer);
    assertEquals("control character was not skiped",'A',buffer.readByte());
  }
 
  @Test
  public void testReadLine() {
    StringBuilder builder = new StringBuilder("REQMOD icap://icap.mimo.ch:1344/reqmod ICAP/1.0").append(new String(IcapCodecUtil.CRLF)).append("NEW LINE");
View Full Code Here

            ChannelBuffer msg = (ChannelBuffer) e.getMessage();
            if (msg.readableBytes() < 8) {
                channelFuture.setFailure(new IOException("invalid sock server reply length = " + msg.readableBytes()));
            }
            // ignore
            msg.readByte();
            int status = msg.readByte();
            int port = msg.readShort();
            byte[] addr = new byte[4];
            msg.readBytes(addr);
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.