Java Code Examples for java.io.DataOutput#writeBoolean()

The following examples show how to use java.io.DataOutput#writeBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GatewaySenderEventImpl.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void toData(DataOutput out) throws IOException {
  // Make sure we are initialized before we serialize.
  initialize();
  out.writeShort(VERSION);
  out.writeInt(this.action);
  out.writeInt(this.numberOfParts);
  // out.writeUTF(this._id);
  DataSerializer.writeObject(this.id, out);
  DataSerializer.writeString(this.regionPath, out);
  // serialize key values. A different function so that base classes can 
  // override this function implement their own serialization. 
  out.writeByte(this.valueIsObject);
  serializeKey(out);
  DataSerializer.writeByteArray(getSerializedValue(), out);
  DataSerializer.writeObject(this.callbackArgument, out);
  out.writeBoolean(this.possibleDuplicate);
  out.writeLong(this.creationTime);
  out.writeInt(this.bucketId);
  out.writeLong(this.shadowKey);
  out.writeLong(getVersionTimeStamp());    
}
 
Example 2
Source File: NestedDelta.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void toDelta(DataOutput out) throws IOException,
    InvalidDeltaException {
  
  System.out.println("Extracting delta to " + this.toString());

  out.writeBoolean(boolFldChd);
  if (boolFldChd) {
    out.writeBoolean(this.fldSwitch);
    this.boolFldChd = false;
    System.out.println(" Wrote modified field 'fldSwitch' = " + this.fldSwitch + " to DataOutput");
  }

  out.writeBoolean(intFldChd);
  if (intFldChd) {
    out.writeInt(this.fldIdent);
    this.intFldChd = false;
    System.out.println(" Wrote modified field 'fldIdent' = " + this.fldIdent + " to DataOutput");
  }
}
 
Example 3
Source File: ContainerTask.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  out.writeBoolean(shouldDie);
  if (taskSpec != null) {
    out.writeBoolean(true);
    taskSpec.write(out);
  } else {
    out.writeBoolean(false);
  }
  if (additionalResources != null) {
    out.writeInt(additionalResources.size());
    for (Entry<String, TezLocalResource> lrEntry : additionalResources.entrySet()) {
      out.writeUTF(lrEntry.getKey());
      lrEntry.getValue().write(out);
    }
  } else {
    out.writeInt(-1);
  }
  out.writeBoolean(credentialsChanged);
  if (credentialsChanged) {
    out.writeBoolean(credentials != null);
    if (credentials != null) {
      credentials.write(out);
    }
  }
}
 
Example 4
Source File: TestDataHelper.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
private static void write(DataOutput out, Object data) throws IOException {
  if (data instanceof Integer) {
    out.writeInt((Integer)data);
  } else if (data instanceof String) {
    out.writeUTF((String)data);
  } else if (data instanceof Boolean) {
    out.writeBoolean((Boolean)data);
  } else {
    throw new IllegalArgumentException("Unknown type " + data);
  }
}
 
Example 5
Source File: DistCh.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
public void write(DataOutput out) throws IOException {
  Text.writeString(out, src.toString());
  DistTool.writeString(out, owner);
  DistTool.writeString(out, group);

  boolean b = permission != null;
  out.writeBoolean(b);
  if (b) {permission.write(out);}
}
 
Example 6
Source File: JvmTask.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput out) throws IOException {
  out.writeBoolean(shouldDie);
  if (t != null) {
    out.writeBoolean(true);
    out.writeBoolean(t.isMapTask());
    t.write(out);
  } else {
    out.writeBoolean(false);
  }
}
 
Example 7
Source File: Arja_00160_s.java    From coming with MIT License 5 votes vote down vote up
public void writeTo(DataOutput out) throws IOException {
    out.writeByte(iMode);
    out.writeByte(iMonthOfYear);
    out.writeByte(iDayOfMonth);
    out.writeByte(iDayOfWeek);
    out.writeBoolean(iAdvance);
    writeMillis(out, iMillisOfDay);
}
 
Example 8
Source File: InitialImageOperation.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
@Override  
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  DataSerializer.writeString(this.regionPath, out);
  out.writeInt(this.processorId);
  out.writeBoolean(this.keysOnly);
  out.writeBoolean(this.targetReinitialized);
  out.writeBoolean(this.checkTombstoneVersions);
  out.writeBoolean(this.unfinishedKeysOnly);
  DataSerializer.writeObject(this.lostMemberVersionID, out);
  DataSerializer.writeObject(this.versionVector, out);
  DataSerializer.writeObject(this.lostMemberID, out);
  DataSerializer.writeObject(this.unfinishedKeys, out);
}
 
Example 9
Source File: AegisthusKey.java    From aegisthus with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput dos) throws IOException {
    dos.writeInt(key.array().length);
    dos.write(key.array());

    if (sourcePath.isEmpty()) {
        dos.writeInt(0);
    } else {
        byte[] bytes = sourcePath.getBytes(Charsets.UTF_8);
        dos.writeInt(bytes.length);
        dos.write(bytes);
    }

    // Optional column name
    if (this.name == null) {
        dos.writeInt(0);
    } else {
        dos.writeInt(name.array().length);
        dos.write(name.array());
    }

    // Optional timestamp
    if (this.timestamp != null) {
        dos.writeBoolean(true);
        dos.writeLong(timestamp);
    } else {
        dos.writeBoolean(false);
    }
}
 
Example 10
Source File: DomainEntrySet.java    From Arabesque with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput dataOutput,
        WriterSetConsumer writerSetConsumer) throws IOException {
    if (pointers == null) {
        dataOutput.writeBoolean(false);
    } else {
        dataOutput.writeBoolean(true);
        dataOutput.writeInt(pointers.size());
        writerSetConsumer.setOutput(dataOutput);
        pointers.forEach(writerSetConsumer);
    }
}
 
Example 11
Source File: HdfsFileStatus.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput out) throws IOException {
  out.writeInt(path.length);
  out.write(path);
  out.writeLong(length);
  out.writeBoolean(isdir);
  out.writeShort(block_replication);
  out.writeLong(blocksize);
  out.writeLong(modification_time);
  out.writeLong(access_time);
  permission.write(out);
  Text.writeString(out, owner);
  Text.writeString(out, group);
}
 
Example 12
Source File: jMutRepair_0037_s.java    From coming with MIT License 5 votes vote down vote up
public void writeTo(DataOutput out) throws IOException {
    out.writeByte(iMode);
    out.writeByte(iMonthOfYear);
    out.writeByte(iDayOfMonth);
    out.writeByte(iDayOfWeek);
    out.writeBoolean(iAdvance);
    writeMillis(out, iMillisOfDay);
}
 
Example 13
Source File: StructBag.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  out.writeBoolean(this.modifiable);
}
 
Example 14
Source File: TypeAdapterRegistry.java    From BungeeTabListPlus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void write(DataOutput output, Boolean object) throws IOException {
    output.writeBoolean(object);
}
 
Example 15
Source File: RemoteContainsKeyValueMessage.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Override
public void toData(DataOutput out) throws IOException
{
  super.toData(out);
  out.writeBoolean(this.containsKeyValue);
}
 
Example 16
Source File: JGenProg2017_0076_t.java    From coming with MIT License 4 votes vote down vote up
public void writeTo(DataOutput out) throws IOException {
    int size = iTransitions.length;

    // Create unique string pool.
    Set<String> poolSet = new HashSet<String>();
    for (int i=0; i<size; i++) {
        poolSet.add(iNameKeys[i]);
    }

    int poolSize = poolSet.size();
    if (poolSize > 65535) {
        throw new UnsupportedOperationException("String pool is too large");
    }
    String[] pool = new String[poolSize];
    Iterator<String> it = poolSet.iterator();
    for (int i=0; it.hasNext(); i++) {
        pool[i] = it.next();
    }

    // Write out the pool.
    out.writeShort(poolSize);
    for (int i=0; i<poolSize; i++) {
        out.writeUTF(pool[i]);
    }

    out.writeInt(size);

    for (int i=0; i<size; i++) {
        writeMillis(out, iTransitions[i]);
        writeMillis(out, iWallOffsets[i]);
        writeMillis(out, iStandardOffsets[i]);
        
        // Find pool index and write it out.
        String nameKey = iNameKeys[i];
        for (int j=0; j<poolSize; j++) {
            if (pool[j].equals(nameKey)) {
                if (poolSize < 256) {
                    out.writeByte(j);
                } else {
                    out.writeShort(j);
                }
                break;
            }
        }
    }

    out.writeBoolean(iTailZone != null);
    if (iTailZone != null) {
        iTailZone.writeTo(out);
    }
}
 
Example 17
Source File: RowValueConstructorExpression.java    From phoenix with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    super.write(output);
    output.writeBoolean(literalExprPtr != null);
}
 
Example 18
Source File: StartupMessage.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  out.writeBoolean(this.directChannel != null);
  if (this.directChannel != null) {
    InternalDataSerializer.invokeToData(this.directChannel, out);
  }
  // for erstwhile license properties
  DataSerializer.writeObject(null, out);
  DataSerializer.writeString(this.version, out);
  out.writeInt(this.replyProcessorId);
  out.writeBoolean(this.isMcastEnabled);
  out.writeBoolean(this.isMcastDiscovery);
  out.writeBoolean(this.isTcpDisabled);

  // Send a description of all of the DataSerializers and
  // Instantiators that have been registered
  SerializerAttributesHolder[] sahs = InternalDataSerializer.getSerializersForDistribution();
  out.writeInt(sahs.length);
  for (int i = 0; i < sahs.length; i++) {
    DataSerializer.writeNonPrimitiveClassName(sahs[i].getClassName(), out);
    out.writeInt(sahs[i].getId());
  }

  Object[] insts = InternalInstantiator.getInstantiatorsForSerialization();
  out.writeInt(insts.length);
  for (int i = 0; i < insts.length; i++) {
    String instantiatorClassName, instantiatedClassName;
    int id;
    if (insts[i] instanceof Instantiator) {
      instantiatorClassName = ((Instantiator)insts[i]).getClass().getName();
      instantiatedClassName = ((Instantiator)insts[i]).getInstantiatedClass().getName();
      id = ((Instantiator)insts[i]).getId();
    } else {
      instantiatorClassName = ((InstantiatorAttributesHolder)insts[i]).getInstantiatorClassName();
      instantiatedClassName = ((InstantiatorAttributesHolder)insts[i]).getInstantiatedClassName();
      id = ((InstantiatorAttributesHolder)insts[i]).getId();
    }
    DataSerializer.writeNonPrimitiveClassName(instantiatorClassName, out);
    DataSerializer.writeNonPrimitiveClassName(instantiatedClassName, out);
    out.writeInt(id);
  }
  DataSerializer.writeObject(interfaces, out);
  out.writeInt(distributedSystemId);
  DataSerializer.writeString(redundancyZone, out);
  out.writeBoolean(enforceUniqueZone);
  
  StartupMessageData data = new StartupMessageData();
  data.writeHostedLocators(this.hostedLocators);
  data.writeMcastPort(this.mcastPort);
  data.writeMcastHostAddress(this.mcastHostAddress);
  data.toData(out);
}
 
Example 19
Source File: Arja_00160_t.java    From coming with MIT License 4 votes vote down vote up
public void writeTo(DataOutput out) throws IOException {
    int size = iTransitions.length;

    // Create unique string pool.
    Set<String> poolSet = new HashSet<String>();
    for (int i=0; i<size; i++) {
        poolSet.add(iNameKeys[i]);
    }

    int poolSize = poolSet.size();
    if (poolSize > 65535) {
        throw new UnsupportedOperationException("String pool is too large");
    }
    String[] pool = new String[poolSize];
    Iterator<String> it = poolSet.iterator();
    for (int i=0; it.hasNext(); i++) {
        pool[i] = it.next();
    }

    // Write out the pool.
    out.writeShort(poolSize);
    for (int i=0; i<poolSize; i++) {
        out.writeUTF(pool[i]);
    }

    out.writeInt(size);

    for (int i=0; i<size; i++) {
        writeMillis(out, iTransitions[i]);
        writeMillis(out, iWallOffsets[i]);
        writeMillis(out, iStandardOffsets[i]);
        
        // Find pool index and write it out.
        String nameKey = iNameKeys[i];
        for (int j=0; j<poolSize; j++) {
            if (pool[j].equals(nameKey)) {
                if (poolSize < 256) {
                    out.writeByte(j);
                } else {
                    out.writeShort(j);
                }
                break;
            }
        }
    }

    out.writeBoolean(iTailZone != null);
    if (iTailZone != null) {
        iTailZone.writeTo(out);
    }
}
 
Example 20
Source File: GlobalSortingMixedOrderITCase.java    From stratosphere with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
	out.writeBoolean(this.ascendingI1);
	out.writeBoolean(this.ascendingI2);
	out.writeBoolean(this.ascendingI3);
}