Package org.jboss.netty.buffer

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


            // Validate stored data.
            ChannelBuffer buffer = data.getChannelBuffer();

            assertEquals(0, buffer.readerIndex());
            assertEquals(bytes.length, buffer.writerIndex());
            assertArrayEquals(bytes, Arrays.copyOf(buffer.array(), bytes.length));
        }
    }

    /** Memory-based HTTP data implementation for test purposes. */
 
View Full Code Here


    } catch (IOException e) {
      throw new RuntimeException("Should never happen", e);
    }
    // We wrote to the underlying buffer but Netty didn't see the writes,
    // so move the write index forward.
    header.writerIndex(buf.length);
    return header;
  }

  /** Hello header for HBase 0.92 to 0.94.  */
  private ChannelBuffer header092() {
View Full Code Here

    final byte[] buf = new byte[4 + 1 + 4 + 1 + 44];
    final ChannelBuffer header = commonHeader(buf, HRPC3);

    // Serialized ipc.ConnectionHeader
    // We skip 4 bytes now and will set it to the actual size at the end.
    header.writerIndex(header.writerIndex() + 4)// 4
    final String klass = "org.apache.hadoop.hbase.ipc.HRegionInterface";
    header.writeByte(klass.length());              // 1
    header.writeBytes(Bytes.ISO88591(klass));      // 44

    // Now set the length of the whole damn thing.
View Full Code Here

    final byte[] buf = new byte[4 + 1 + 4 + 1 + 44];
    final ChannelBuffer header = commonHeader(buf, HRPC3);

    // Serialized ipc.ConnectionHeader
    // We skip 4 bytes now and will set it to the actual size at the end.
    header.writerIndex(header.writerIndex() + 4)// 4
    final String klass = "org.apache.hadoop.hbase.ipc.HRegionInterface";
    header.writeByte(klass.length());              // 1
    header.writeBytes(Bytes.ISO88591(klass));      // 44

    // Now set the length of the whole damn thing.
View Full Code Here

    header.writeBytes(Bytes.ISO88591(klass));      // 44

    // Now set the length of the whole damn thing.
    // -4 because the length itself isn't part of the payload.
    // -5 because the "hrpc" + version isn't part of the payload.
    header.setInt(5, header.writerIndex() - 4 - 5);
    return header;
  }

  /** Hello header for HBase 0.90 and earlier.  */
  private ChannelBuffer header090() {
View Full Code Here

    // Serialized UserGroupInformation to say who we are.
    // We're not nice so we're not gonna say who we are and we'll just send
    // `null' (hadoop.io.ObjectWritable$NullInstance).
    // First, we need the size of the whole damn UserGroupInformation thing.
    // We skip 4 bytes now and will set it to the actual size at the end.
    header.writerIndex(header.writerIndex() + 4);             // 4
    // Write the class name of the object.
    // See hadoop.io.ObjectWritable#writeObject
    // See hadoop.io.UTF8#writeString
    // String length as a short followed by UTF-8 string.
    String klass = "org.apache.hadoop.io.Writable";
View Full Code Here

    // Serialized UserGroupInformation to say who we are.
    // We're not nice so we're not gonna say who we are and we'll just send
    // `null' (hadoop.io.ObjectWritable$NullInstance).
    // First, we need the size of the whole damn UserGroupInformation thing.
    // We skip 4 bytes now and will set it to the actual size at the end.
    header.writerIndex(header.writerIndex() + 4);             // 4
    // Write the class name of the object.
    // See hadoop.io.ObjectWritable#writeObject
    // See hadoop.io.UTF8#writeString
    // String length as a short followed by UTF-8 string.
    String klass = "org.apache.hadoop.io.Writable";
View Full Code Here

    header.writeBytes(Bytes.ISO88591(klass));                 // 47

    // Now set the length of the whole damn thing.
    // -4 because the length itself isn't part of the payload.
    // -5 because the "hrpc" + version isn't part of the payload.
    header.setInt(5, header.writerIndex() - 4 - 5);
    return header;
  }

  /** CDH3b3-specific header for Hadoop "security".  */
  private ChannelBuffer headerCDH3b3() {
View Full Code Here

          nkeys = 0;
        }

        nregions++;
        writeByteArray(buf, region_name)// The region name.
        nkeys_index = buf.writerIndex();
        // Number of keys for which we have RPCs for this region.
        buf.writeInt(0)// We'll monkey patch this later.
      }

      final byte[] key = rpc.key;
View Full Code Here

        // deletes for that row.  See HRegion.prepareDelete() for more info.
        buf.writeLong(rpc.timestamp)// Timestamp.

        buf.writeLong(RowLock.NO_LOCK);    // Lock ID.
        buf.writeByte(rpc.durable ? 0x01 : 0x00)// Use the WAL?
        nfamilies_index = buf.writerIndex();
        // Number of families that follow.
        buf.writeInt(0)// We'll monkey patch this later.
      }

      if (new_family) {
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.