Package org.apache.hadoop.record

Examples of org.apache.hadoop.record.Buffer


    list.add(true);
    list.add(123456789L);
    Map<Object, Object> map = new HashMap<Object, Object>();
    map.put("one", 1);
    map.put("vector", vector);
    Buffer buffer = new Buffer(new byte[] { 1, 2, 3, 4 });
    buffer.setCapacity(10);
    Object[] objects = new Object[] {
      buffer,
      (byte) 123, true, 12345, 123456789L, (float) 1.2, 1.234,
      "random string", vector, list, map
    };
View Full Code Here


    r1.setFloatVal(3.145F);
    r1.setDoubleVal(1.5234);
    r1.setIntVal(-4567);
    r1.setLongVal(-2367L);
    r1.setStringVal("random text");
    r1.setBufferVal(new Buffer());
    r1.setVectorVal(new ArrayList<String>());
    r1.setMapVal(new TreeMap<String, String>());
    RecRecord0 r0 = new RecRecord0();
    r0.setStringVal("other random text");
    r1.setRecordVal(r0);
View Full Code Here

    r1.setFloatVal(3.145F);
    r1.setDoubleVal(1.5234);
    r1.setIntVal(-4567);
    r1.setLongVal(-2367L);
    r1.setStringVal("random text");
    r1.setBufferVal(new Buffer());
    r1.setVectorVal(new ArrayList<String>());
    r1.setMapVal(new TreeMap<String, String>());
    RecRecord0 r0 = new RecRecord0();
    r0.setStringVal("other random text");
    r1.setRecordVal(r0);
View Full Code Here

          LOG
              .error("ArcFileBuilder Encountered Item with Zero Length Content. URI:"
                  + _item.getUri());
        } else {
          _item.setContent(_buffer,false);
          _buffer = new Buffer();
        }
        _item = null;
      } else {
        throw new IOException(
            "ArcBuilder finish calledin Invalid State. State:" + _state
View Full Code Here

      code = in.readUnsignedByte();
    } catch (EOFException eof) {
      return null;
    }
    if (code == Type.BYTES.code) {
      return new Buffer(readBytes());
    } else if (code == Type.BYTE.code) {
      return readByte();
    } else if (code == Type.BOOL.code) {
      return readBool();
    } else if (code == Type.INT.code) {
      return readInt();
    } else if (code == Type.SHORT.code) {
      return readShort();
    } else if (code == Type.LONG.code) {
      return readLong();
    } else if (code == Type.FLOAT.code) {
      return readFloat();
    } else if (code == Type.DOUBLE.code) {
      return readDouble();
    } else if (code == Type.STRING.code) {
      return readString();
    } else if (code == Type.VECTOR.code) {
      return readVector();
    } else if (code == Type.LIST.code) {
      return readList();
    } else if (code == Type.MAP.code) {
      return readMap();
    } else if (code == Type.MARKER.code) {
      return null;
    } else if (50 <= code && code <= 200) { // application-specific typecodes
      return new Buffer(readBytes());
    } else {
      throw new RuntimeException("unknown type");
    }
  }
View Full Code Here

   *
   * @return the obtained bytes sequence
   * @throws IOException
   */
  public byte[] readRawVector() throws IOException {
    Buffer buffer = new Buffer();
    int length = readVectorHeader();
    buffer.append(new byte[] {(byte) Type.VECTOR.code,
        (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)),
        (byte) (0xff & (length >> 8)), (byte) (0xff & length)});
    for (int i = 0; i < length; i++) {
      buffer.append(readRaw());
    }
    return buffer.get();
  }
View Full Code Here

   *
   * @return the obtained bytes sequence
   * @throws IOException
   */
  public byte[] readRawList() throws IOException {
    Buffer buffer = new Buffer(new byte[] {(byte) Type.LIST.code});
    byte[] bytes = readRaw();
    while (bytes != null) {
      buffer.append(bytes);
      bytes = readRaw();
    }
    buffer.append(new byte[] {(byte) Type.MARKER.code});
    return buffer.get();
  }
View Full Code Here

   *
   * @return the obtained bytes sequence
   * @throws IOException
   */
  public byte[] readRawMap() throws IOException {
    Buffer buffer = new Buffer();
    int length = readMapHeader();
    buffer.append(new byte[] {(byte) Type.MAP.code,
        (byte) (0xff & (length >> 24)), (byte) (0xff & (length >> 16)),
        (byte) (0xff & (length >> 8)), (byte) (0xff & length)});
    for (int i = 0; i < length; i++) {
      buffer.append(readRaw());
      buffer.append(readRaw());
    }
    return buffer.get();
  }
View Full Code Here

    return in.readBool();
  }

  public Buffer readBuffer(String tag) throws IOException {
    in.skipType();
    return new Buffer(in.readBytes());
  }
View Full Code Here

      if (out) {
          byte [] value_byte = value0.value();
          if (value_byte == null) {
              throw new IOException("SingleValue requires at least one column to be present for each row, this should not be possible!");
          }
    key.setValue(new Buffer(key0.get()));
    value.setValue(new Buffer(value_byte));
      }
      return out;

  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.record.Buffer

Copyright © 2018 www.massapicom. 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.