示例#1
0
  public void serialize(RangeSliceCommand sliceCommand, DataOutput dos, int version)
      throws IOException {
    dos.writeUTF(sliceCommand.keyspace);
    dos.writeUTF(sliceCommand.column_family);
    ByteBuffer sc = sliceCommand.super_column;
    dos.writeInt(sc == null ? 0 : sc.remaining());
    if (sc != null) ByteBufferUtil.write(sc, dos);

    TSerializer ser = new TSerializer(new TBinaryProtocol.Factory());
    FBUtilities.serialize(ser, sliceCommand.predicate, dos);

    if (version >= MessagingService.VERSION_11) {
      if (sliceCommand.row_filter == null) {
        dos.writeInt(0);
      } else {
        dos.writeInt(sliceCommand.row_filter.size());
        for (IndexExpression expr : sliceCommand.row_filter) FBUtilities.serialize(ser, expr, dos);
      }
    }
    AbstractBounds.serializer().serialize(sliceCommand.range, dos, version);
    dos.writeInt(sliceCommand.maxResults);
    if (version >= MessagingService.VERSION_11) {
      dos.writeBoolean(sliceCommand.maxIsColumns);
      dos.writeBoolean(sliceCommand.isPaging);
    }
  }
示例#2
0
 public void serialize(IndexScanCommand o, DataOutput out, int version) throws IOException {
   out.writeUTF(o.keyspace);
   out.writeUTF(o.column_family);
   TSerializer ser = new TSerializer(new TBinaryProtocol.Factory());
   FBUtilities.serialize(ser, o.index_clause, out);
   FBUtilities.serialize(ser, o.predicate, out);
   AbstractBounds.serializer().serialize(o.range, out, version);
 }
 public void serialize(TreeRequest request, DataOutput dos, int version) throws IOException {
   dos.writeUTF(request.sessionid);
   CompactEndpointSerializationHelper.serialize(request.endpoint, dos);
   dos.writeUTF(request.cf.left);
   dos.writeUTF(request.cf.right);
   if (version > MessagingService.VERSION_07)
     AbstractBounds.serializer().serialize(request.range, dos, version);
 }
 public static void writeLongString(DataOutput dos, String str) throws IOException {
   int chunk = 1000;
   int count = str.length() / chunk;
   int remaining = str.length() - (count * chunk);
   dos.writeInt(count + ((remaining > 0) ? 1 : 0));
   for (int i = 0; i < count; i++) {
     dos.writeUTF(str.substring(i * chunk, (i + 1) * chunk));
   }
   if (remaining > 0) {
     dos.writeUTF(str.substring(count * chunk));
   }
 }
  /**
   * DO NOT call symbolTable.addReference in writeObject as this (may) result in a
   * concurrentModificationException.
   *
   * <p>All references should be created in the constructor
   */
  public void writeObject(DataOutput out) throws IOException {
    boolean sgIO = node instanceof com.sun.j3d.utils.scenegraph.io.SceneGraphIO;
    out.writeBoolean(sgIO);
    out.writeInt(symbol.nodeID);

    int nodeClassID = control.getNodeClassID(node);

    out.writeShort(nodeClassID);

    if (nodeClassID == -1) out.writeUTF(nodeClassName);

    writeConstructorParams(out);

    if (sgIO) {
      ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
      DataOutputStream tmpOut = new DataOutputStream(byteStream);
      ((com.sun.j3d.utils.scenegraph.io.SceneGraphIO) node).writeSceneGraphObject(tmpOut);
      tmpOut.close();
      out.writeInt(byteStream.size());
      out.write(byteStream.toByteArray());
    }

    writeUserData(out);
    writeString(node.getName(), out);

    writeCapabilities(out);
  }
示例#6
0
 public void writeUTF(String str) {
   try {
     dataOutput.writeUTF(str);
   } catch (IOException ex) {
     throw new RuntimeException(ex.getMessage());
   }
 }
 public void write(DataOutput out) throws IOException {
   out.write(UNION_TYPE);
   out.writeUTF(name);
   out.writeInt(unionTypes.size());
   for (InferredType it : unionTypes) {
     it.write(out);
   }
 }
 public void write(DataOutput out) throws IOException {
   out.write(STRUCT_TYPE);
   out.writeUTF(name);
   out.writeInt(structTypes.size());
   for (InferredType it : structTypes) {
     it.write(out);
   }
 }
示例#9
0
 public void serialize(DataOutput dos) throws IOException {
   assert !"".equals(columnFamilyName);
   assert superColumnName == null || superColumnName.remaining() > 0;
   assert columnName == null || columnName.remaining() > 0;
   dos.writeUTF(columnFamilyName == null ? "" : columnFamilyName);
   ByteBufferUtil.writeWithShortLength(
       superColumnName == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : superColumnName, dos);
   ByteBufferUtil.writeWithShortLength(
       columnName == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : columnName, dos);
 }
 public void write(DataOutput out) throws IOException {
   out.write(BASE_TYPE);
   out.writeUTF(name);
   out.writeInt(sampleStrs.size());
   for (int i = 0; i < sampleStrs.size(); i++) {
     UTF8.writeString(out, sampleStrs.get(i));
   }
   out.writeInt(tokenClassIdentifier);
   out.writeBoolean(tokenParameter != null);
   if (tokenParameter != null) {
     UTF8.writeString(out, tokenParameter);
   }
 }
 public void write(DataOutput out) throws IOException {
   out.writeUTF(leftBigram.toString());
   out.writeUTF(rightBigram.toString());
 }
 /** Write a possibly null string to the stream */
 protected void writeString(String str, DataOutput out) throws IOException {
   out.writeBoolean(str != null);
   if (str != null) out.writeUTF(str);
 }
示例#13
0
 public void save(DataOutput s, Set<String> set) throws IOException {
   s.writeInt(set.size());
   for (String each : set) {
     s.writeUTF(each);
   }
 }
示例#14
0
 @Override
 void writeExternal(final DataOutput out) throws IOException {
   out.writeUTF(expressionString);
 }
 public void write(DataOutput out) throws IOException {
   out.write(ARRAY_TYPE);
   out.writeUTF(name);
   bodyType.write(out);
 }