@Override
 public void toData(DataOutput out) throws IOException {
   out.writeInt(this.prId);
   out.writeByte(this.scope.ordinal);
   InternalDataSerializer.invokeToData(this.pAttrs, out);
   out.writeBoolean(this.isDestroying);
   out.writeBoolean(this.isColocationComplete);
   InternalDataSerializer.invokeToData(this.nodes, out);
   DataSerializer.writeString(this.partitionResolver, out);
   DataSerializer.writeString(this.colocatedWith, out);
   DataSerializer.writeString(this.fullPath, out);
   InternalDataSerializer.invokeToData(this.ea, out);
   InternalDataSerializer.invokeToData(this.regionIdleTimeout, out);
   InternalDataSerializer.invokeToData(this.regionTimeToLive, out);
   InternalDataSerializer.invokeToData(this.entryIdleTimeout, out);
   InternalDataSerializer.invokeToData(this.entryTimeToLive, out);
   out.writeBoolean(this.firstDataStoreCreated);
   DataSerializer.writeObject(elderFPAs, out);
   DataSerializer.writeArrayList(this.partitionListenerClassNames, out);
   if (this.gatewaySenderIds.isEmpty()) {
     DataSerializer.writeObject(null, out);
   } else {
     DataSerializer.writeObject(this.gatewaySenderIds, out);
   }
 }
예제 #2
0
파일: GMS.java 프로젝트: jtoerber/JGroups
 public void writeTo(DataOutput out) throws Exception {
   out.writeByte(type);
   boolean isMergeView = view != null && view instanceof MergeView;
   out.writeBoolean(isMergeView);
   Util.writeStreamable(view, out);
   Util.writeAddress(mbr, out);
   Util.writeAddresses(mbrs, out);
   Util.writeStreamable(join_rsp, out);
   Util.writeStreamable(my_digest, out);
   Util.writeStreamable(merge_id, out);
   out.writeBoolean(merge_rejected);
   out.writeBoolean(useFlushIfPresent);
 }
 public void write(DataOutput out) throws IOException {
   out.writeBoolean(isNode);
   if (node != null) {
     node.write(out);
   } else {
     contribution.write(out);
   }
 }
예제 #4
0
  /** Write a {@link Writable}, {@link String}, primitive type, or an array of the preceding. */
  public static void writeObject(
      DataOutput out, Object instance, Class declaredClass, Configuration conf) throws IOException {

    if (instance == null) { // null
      instance = new NullInstance(declaredClass, conf);
      declaredClass = Writable.class;
    }

    UTF8.writeString(out, declaredClass.getName()); // always write declared

    if (declaredClass.isArray()) { // array
      int length = Array.getLength(instance);
      out.writeInt(length);
      for (int i = 0; i < length; i++) {
        writeObject(out, Array.get(instance, i), declaredClass.getComponentType(), conf);
      }

    } else if (declaredClass == String.class) { // String
      UTF8.writeString(out, (String) instance);

    } else if (declaredClass.isPrimitive()) { // primitive type

      if (declaredClass == Boolean.TYPE) { // boolean
        out.writeBoolean(((Boolean) instance).booleanValue());
      } else if (declaredClass == Character.TYPE) { // char
        out.writeChar(((Character) instance).charValue());
      } else if (declaredClass == Byte.TYPE) { // byte
        out.writeByte(((Byte) instance).byteValue());
      } else if (declaredClass == Short.TYPE) { // short
        out.writeShort(((Short) instance).shortValue());
      } else if (declaredClass == Integer.TYPE) { // int
        out.writeInt(((Integer) instance).intValue());
      } else if (declaredClass == Long.TYPE) { // long
        out.writeLong(((Long) instance).longValue());
      } else if (declaredClass == Float.TYPE) { // float
        out.writeFloat(((Float) instance).floatValue());
      } else if (declaredClass == Double.TYPE) { // double
        out.writeDouble(((Double) instance).doubleValue());
      } else if (declaredClass == Void.TYPE) { // void
      } else {
        throw new IllegalArgumentException("Not a primitive: " + declaredClass);
      }
    } else if (declaredClass.isEnum()) { // enum
      UTF8.writeString(out, ((Enum) instance).name());
    } else if (Writable.class.isAssignableFrom(declaredClass)) { // Writable
      UTF8.writeString(out, instance.getClass().getName());
      ((Writable) instance).write(out);

    } else {
      throw new IOException("Can't write: " + instance + " as " + declaredClass);
    }
  }
예제 #5
0
 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 writeGenotype(final EvolutionState state, final DataOutput dataOutput)
     throws IOException {
   dataOutput.writeInt(genome.length);
   for (int x = 0; x < genome.length; x++)
     dataOutput.writeBoolean(genome[x]); // inefficient: booleans are written out as bytes
 }