Example #1
0
    public IndexScanCommand deserialize(DataInput in, int version) throws IOException {
      String keyspace = in.readUTF();
      String columnFamily = in.readUTF();

      TDeserializer dser = new TDeserializer(new TBinaryProtocol.Factory());
      IndexClause indexClause = new IndexClause();
      FBUtilities.deserialize(dser, indexClause, in);
      SlicePredicate predicate = new SlicePredicate();
      FBUtilities.deserialize(dser, predicate, in);
      AbstractBounds<RowPosition> range =
          AbstractBounds.serializer().deserialize(in, version).toRowBounds();
      return new IndexScanCommand(keyspace, columnFamily, indexClause, predicate, range);
    }
    public TreeRequest deserialize(DataInput dis, int version) throws IOException {
      String sessId = dis.readUTF();
      InetAddress endpoint = CompactEndpointSerializationHelper.deserialize(dis);
      CFPair cfpair = new CFPair(dis.readUTF(), dis.readUTF());
      Range<Token> range;
      if (version > MessagingService.VERSION_07)
        range = (Range<Token>) AbstractBounds.serializer().deserialize(dis, version);
      else
        range =
            new Range<Token>(
                StorageService.getPartitioner().getMinimumToken(),
                StorageService.getPartitioner().getMinimumToken());

      return new TreeRequest(sessId, endpoint, range, cfpair);
    }
Example #3
0
  public RangeSliceCommand deserialize(DataInput dis, int version) throws IOException {
    String keyspace = dis.readUTF();
    String columnFamily = dis.readUTF();

    int scLength = dis.readInt();
    ByteBuffer superColumn = null;
    if (scLength > 0) {
      byte[] buf = new byte[scLength];
      dis.readFully(buf);
      superColumn = ByteBuffer.wrap(buf);
    }

    TDeserializer dser = new TDeserializer(new TBinaryProtocol.Factory());
    SlicePredicate pred = new SlicePredicate();
    FBUtilities.deserialize(dser, pred, dis);

    List<IndexExpression> rowFilter = null;
    if (version >= MessagingService.VERSION_11) {
      int filterCount = dis.readInt();
      rowFilter = new ArrayList<IndexExpression>(filterCount);
      for (int i = 0; i < filterCount; i++) {
        IndexExpression expr = new IndexExpression();
        FBUtilities.deserialize(dser, expr, dis);
        rowFilter.add(expr);
      }
    }
    AbstractBounds<RowPosition> range =
        AbstractBounds.serializer().deserialize(dis, version).toRowBounds();

    int maxResults = dis.readInt();
    boolean maxIsColumns = false;
    boolean isPaging = false;
    if (version >= MessagingService.VERSION_11) {
      maxIsColumns = dis.readBoolean();
      isPaging = dis.readBoolean();
    }
    return new RangeSliceCommand(
        keyspace,
        columnFamily,
        superColumn,
        pred,
        range,
        rowFilter,
        maxResults,
        maxIsColumns,
        isPaging);
  }
 public Set<String> read(DataInput s) throws IOException {
   int count = s.readInt();
   Set<String> result = new THashSet<String>(count);
   while (count-- > 0) {
     result.add(s.readUTF());
   }
   return result;
 }
 public static String readLongString(DataInput in) throws IOException {
   int count = in.readInt();
   StringBuilder sb = new StringBuilder();
   for (int i = 0; i < count; i++) {
     sb.append(in.readUTF());
   }
   return sb.toString();
 }
Example #6
0
 public static QueryPath deserialize(DataInput din) throws IOException {
   String cfName = din.readUTF();
   ByteBuffer scName = ByteBufferUtil.readWithShortLength(din);
   ByteBuffer cName = ByteBufferUtil.readWithShortLength(din);
   return new QueryPath(
       cfName.isEmpty() ? null : cfName,
       scName.remaining() == 0 ? null : scName,
       cName.remaining() == 0 ? null : cName);
 }
Example #7
0
 ObjectModelValue(final DataInput in) throws IOException {
   super(ModelType.OBJECT);
   final int count = in.readInt();
   final LinkedHashMap<String, ModelNode> map = new LinkedHashMap<String, ModelNode>();
   for (int i = 0; i < count; i++) {
     final String key = in.readUTF();
     final ModelNode value = new ModelNode();
     value.readExternal(in);
     map.put(key, value);
   }
   this.map = map;
 }
 /** Deserialize an unknown InferredType from the given input stream */
 public static InferredType readType(DataInput in) throws IOException {
   InferredType it = null;
   byte b = in.readByte();
   String name = in.readUTF();
   if (b == BASE_TYPE) {
     it = new BaseType(name);
   } else if (b == STRUCT_TYPE) {
     it = new StructType(name);
   } else if (b == ARRAY_TYPE) {
     it = new ArrayType(name);
   } else if (b == UNION_TYPE) {
     it = new UnionType(name);
   } else {
     throw new IOException("No type found: " + b);
   }
   it.readFields(in);
   return it;
 }
  public void readObject(DataInput in) throws IOException {

    boolean sgIO = in.readBoolean();
    int nodeID = in.readInt();

    int nodeClassID = in.readShort();

    nodeClassName = null;

    if (nodeClassID == -1) nodeClassName = in.readUTF();

    readConstructorParams(in);

    if (nodeClassID != -1) {
      node = createNode();
      nodeClassName = node.getClass().getName();
    } else node = createNode(nodeClassName);

    if (sgIO) {
      if (control.getCurrentFileVersion() == 1)
        ((com.sun.j3d.utils.scenegraph.io.SceneGraphIO) node).readSceneGraphObject(in);
      else {
        int size = in.readInt();
        if (node instanceof com.sun.j3d.utils.scenegraph.io.SceneGraphIO) {
          byte[] bytes = new byte[size];
          in.readFully(bytes);
          ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
          DataInputStream tmpIn = new DataInputStream(byteStream);
          ((com.sun.j3d.utils.scenegraph.io.SceneGraphIO) node).readSceneGraphObject(tmpIn);
          tmpIn.close();
        } else {
          in.skipBytes(size);
        }
      }
    }

    symbol = control.getSymbolTable().createSymbol(this, node, nodeID);
    readUserData(in);
    if (control.getCurrentFileVersion() > 2) {
      node.setName(readString(in));
    }

    readCapabilities(in);
  }
 public void readFields(DataInput in) throws IOException {
   leftBigram = new Text(in.readUTF());
   rightBigram = new Text(in.readUTF());
 }
 /** Read and return a possibly null string */
 protected String readString(DataInput in) throws IOException {
   if (in.readBoolean()) return (in.readUTF());
   return null;
 }
Example #12
0
 public String deserialize(DataInput in, int version) throws IOException
 {
     return in.readUTF();
 }