java.io.DataOutput Java Examples

The following examples show how to use java.io.DataOutput. 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 Project: big-c   Author: yncxcw   File: SnapshotFSImageFormat.java    License: Apache License 2.0 6 votes vote down vote up
public void writeINodeReferenceWithCount(
    INodeReference.WithCount withCount, DataOutput out,
    boolean writeUnderConstruction) throws IOException {
  final INode referred = withCount.getReferredINode();
  final long id = withCount.getId();
  final boolean firstReferred = !referenceMap.containsKey(id);
  out.writeBoolean(firstReferred);

  if (firstReferred) {
    FSImageSerialization.saveINode2Image(referred, out,
        writeUnderConstruction, this);
    referenceMap.put(id, withCount);
  } else {
    out.writeLong(id);
  }
}
 
Example #2
Source Project: phoenix   Author: cloudera-labs   File: ColumnProjectionFilter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    WritableUtils.writeCompressedByteArray(output, this.emptyCFName);
    WritableUtils.writeVInt(output, this.columnsTracker.size());
    for (Entry<ImmutableBytesPtr, NavigableSet<ImmutableBytesPtr>> entry : this.columnsTracker.entrySet()) {
        // write family name
        WritableUtils.writeCompressedByteArray(output, entry.getKey().copyBytes());
        int qaulsSize = entry.getValue() == null ? 0 : entry.getValue().size();
        WritableUtils.writeVInt(output, qaulsSize);
        if (qaulsSize > 0) {
            for (ImmutableBytesPtr cq : entry.getValue()) {
                // write qualifier name
                WritableUtils.writeCompressedByteArray(output, cq.copyBytes());
            }
        }
    }
    // Write conditionOnlyCfs
    WritableUtils.writeVInt(output, this.conditionOnlyCfs.size());
    for (byte[] f : this.conditionOnlyCfs) {
        WritableUtils.writeCompressedByteArray(output, f);
    }
}
 
Example #3
Source Project: coming   Author: SpoonLabs   File: jMutRepair_0051_s.java    License: MIT License 6 votes vote down vote up
/**
 * Encodes a built DateTimeZone to the given stream. Call readFrom to
 * decode the data into a DateTimeZone object.
 *
 * @param out  the output stream to receive the encoded DateTimeZone
 * @since 1.5 (parameter added)
 */
public void writeTo(String zoneID, DataOutput out) throws IOException {
    // pass false so zone id is not written out
    DateTimeZone zone = toDateTimeZone(zoneID, false);

    if (zone instanceof FixedDateTimeZone) {
        out.writeByte('F'); // 'F' for fixed
        out.writeUTF(zone.getNameKey(0));
        writeMillis(out, zone.getOffset(0));
        writeMillis(out, zone.getStandardOffset(0));
    } else {
        if (zone instanceof CachedDateTimeZone) {
            out.writeByte('C'); // 'C' for cached, precalculated
            zone = ((CachedDateTimeZone)zone).getUncachedZone();
        } else {
            out.writeByte('P'); // 'P' for precalculated, uncached
        }
        ((PrecalculatedZone)zone).writeTo(out);
    }
}
 
Example #4
Source Project: systemds   Author: tugraz-isds   File: ColGroupDDC2.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
	int numCols = getNumCols();
	int numVals = getNumValues();
	out.writeInt(_numRows);
	out.writeInt(numCols);
	out.writeInt(numVals);

	// write col indices
	for(int i = 0; i < _colIndexes.length; i++)
		out.writeInt(_colIndexes[i]);

	// write distinct values
	for(int i = 0; i < _values.length; i++)
		out.writeDouble(_values[i]);

	// write data
	for(int i = 0; i < _numRows; i++)
		out.writeChar(_data[i]);
}
 
Example #5
Source Project: gemfirexd-oss   Author: gemxd   File: DistributedCacheOperation.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  // extra short added for 7.5
  Version version = InternalDataSerializer
          .getVersionForDataStreamOrNull(out);
  if (version == null || Version.GFE_75.compareTo(version) <= 0) {
    short extBits = computeCompressedExtBits((short) 0);
    out.writeShort(extBits);
  }
  DataSerializer.writeString(this.regionPath, out);
  out.writeByte(this.op.ordinal);
  if (this.callbackArg != null) {
    DataSerializer.writeObject(this.callbackArg, out);
  }
  if (this.hasOldValue) {
    out.writeByte(this.oldValueIsObject);
    final byte policy = valueIsToDeserializationPolicy(this.oldValueIsObject);
    final Object vObj;
    final byte[] vBytes;
    if (this.oldValueIsObject == VALUE_IS_BYTES && this.oldValue instanceof byte[]) {
      vObj = null;
      vBytes = (byte[])this.oldValue;
    } else {
      vObj = this.oldValue;
      vBytes = null;
    }
    writeValue(policy, vObj, vBytes, out);
  }
  if (this.filterRouting != null) {
    InternalDataSerializer.invokeToData(this.filterRouting, out);
  }
  if (this.versionTag != null) {
    InternalDataSerializer.invokeToData(this.versionTag,out);
  }
}
 
Example #6
Source Project: data-polygamy   Author: VIDA-NYU   File: FrameworkUtils.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(aggregations.length);
    for (int i = 0; i < aggregations.length; i++) {
        out.writeInt(aggregations[i].getId().ordinal());
        aggregations[i].write(out);
    }
}
 
Example #7
Source Project: gemfirexd-oss   Author: gemxd   File: FxRate.java    License: Apache License 2.0 5 votes vote down vote up
public void toData(DataOutput output) throws IOException {
  DataSerializer.writeString(id_ccy_std, output);
  ;
  output.writeInt(id_region);
  DataSerializer.writeString(id_ccy_bse, output);
  output.writeFloat(id_region);
}
 
Example #8
Source Project: gemfirexd-oss   Author: gemxd   File: InternalDataSerializer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  DataSerializer.writeNonPrimitiveClassName(this.className, out);
  out.writeInt(this.id);
  DataSerializer.writeObject(this.eventId, out);
}
 
Example #9
Source Project: RDFS   Author: iVCE   File: NamespaceInfo.java    License: Apache License 2.0 5 votes vote down vote up
public void write(DataOutput out) throws IOException {
  UTF8.writeString(out, getBuildVersion());
  out.writeInt(getLayoutVersion());
  out.writeInt(getNamespaceID());
  out.writeLong(getCTime());
  out.writeInt(getDistributedUpgradeVersion());
}
 
Example #10
Source Project: big-c   Author: yncxcw   File: RawLocalFileSystem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  if (!isPermissionLoaded()) {
    loadPermissionInfo();
  }
  super.write(out);
}
 
Example #11
Source Project: gemfirexd-oss   Author: gemxd   File: GfxdJarMessage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void toData(DataOutput out)
    throws IOException {
  super.toData(out);

  if (GemFireXDUtils.TraceApplicationJars) {
    SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_APP_JARS,
        "GfxdJarMessage#toData: this.sendBytes " + this.sendBytes
            + " and jar bytes " + Arrays.toString(this.jar_bytes));
  }

  out.writeLong(this.id);
  DataSerializer.writeString(this.schemaName, out);
  DataSerializer.writeString(this.sqlName, out);
  DataSerializer.writeByte((byte)this.type, out);

  if (this.type != JAR_REMOVE) {
    if (this.sendBytes) {
      if (GemFireXDUtils.TraceApplicationJars) {
        SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_APP_JARS,
            "GfxdJarMessage#toData: writing byte array "
                + Arrays.toString(this.jar_bytes));
      }
      DataSerializer.writeByteArray(this.jar_bytes, out);
    }
    else {
      if (GemFireXDUtils.TraceApplicationJars) {
        SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_APP_JARS,
            "GfxdJarMessage#toData: sending null jar bytes "
                + Arrays.toString(this.jar_bytes));
      }
      DataSerializer.writeByteArray(null, out);
    }
    DataSerializer.writeLong(this.oldId, out);
  }
}
 
Example #12
Source Project: gemfirexd-oss   Author: gemxd   File: TradesHdfsDataVerifierV2.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  System.out.println("writing Trades cid:" + cid + " tid: " + tid + " eid: " + eid + " tradeDate: " + tradeDate.getTime());
  out.writeInt(cid);
  out.writeInt(tid);
  out.writeInt(eid);
  out.writeLong(tradeDate.getTime());
  
}
 
Example #13
Source Project: vxquery   Author: apache   File: SubtractOperation.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void operateDTDurationInteger(LongPointable longp1, LongPointable longp2, DataOutput dOut)
        throws SystemException, IOException {
    long value = longp1.longValue();
    value -= longp2.longValue();
    dOut.write(ValueTag.XS_DAY_TIME_DURATION_TAG);
    dOut.writeLong(value);
}
 
Example #14
Source Project: gemfirexd-oss   Author: gemxd   File: RemoteOperationMessage.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Send the contents of this instance to the DataOutput Required to be a
 * {@link com.gemstone.gemfire.DataSerializable}Note: must be symmetric with
 * {@link #fromData(DataInput)}in what it writes
 */
@Override
public void toData(DataOutput out) throws IOException
{
  super.toData(out);
  DataSerializer.writeString(this.regionPath,out);
}
 
Example #15
Source Project: ignite   Author: apache   File: BinarySchema.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * The object implements the writeTo method to save its contents
 * by calling the methods of DataOutput for its primitive values and strings or
 * calling the writeTo method for other objects.
 *
 * @param out the stream to write the object to.
 * @throws IOException Includes any I/O exceptions that may occur.
 */
public void writeTo(DataOutput out) throws IOException {
    out.writeInt(schemaId);

    out.writeInt(ids.length);

    for (Integer id : ids)
        out.writeInt(id);
}
 
Example #16
Source Project: wildfly-core   Author: wildfly   File: ManagementProtocolHeader.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Write the header information to the provided {@link java.io.DataOutput}.
 *
 * @param output The output to write to
 * @throws IOException If any problems occur writing to the output
 */
public void write(final DataOutput output) throws IOException {
    output.write(ManagementProtocol.SIGNATURE);
    output.writeByte(ManagementProtocol.VERSION_FIELD);
    output.writeInt(getVersion());
    output.writeByte(ManagementProtocol.TYPE);
    output.writeByte(getType());
}
 
Example #17
Source Project: coming   Author: SpoonLabs   File: jKali_0030_s.java    License: 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 #18
Source Project: gemfirexd-oss   Author: gemxd   File: BucketServerLocation66.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  DataSerializer.writeInteger(this.bucketId, out);
  DataSerializer.writeBoolean(this.isPrimary, out);
  DataSerializer.writeByte(this.version, out);
  out.writeByte(this.numServerGroups);
  if(this.numServerGroups > 0) {
    for(String s: this.serverGroups) {
      DataSerializer.writeString(s, out);
    }
  }
}
 
Example #19
Source Project: phoenix   Author: forcedotcom   File: RowKeyValueAccessor.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    // Encode hasSeparator and isFixedLength into vint storing offset array length
    // (since there's plenty of room)
    int length = offsets.length << 2;
    length |= (hasSeparator ? 1 << 1 : 0) | (isFixedLength ? 1 : 0);
    ByteUtil.serializeVIntArray(output, offsets, length);
}
 
Example #20
Source Project: xmrwallet   Author: m2049r   File: Bucket.java    License: Apache License 2.0 5 votes vote down vote up
public void send(DataOutput out) throws IOException {
    out.writeLong(signature);
    out.writeLong(cb);
    out.writeBoolean(haveToReturnData);
    out.writeInt(command);
    out.writeInt(returnCode);
    out.writeInt(flags);
    out.writeInt(protcolVersion);
    out.write(payload);
}
 
Example #21
Source Project: gemfirexd-oss   Author: gemxd   File: StatAlertNotification.java    License: Apache License 2.0 5 votes vote down vote up
public void toData(DataOutput out) throws IOException {
  // Do not modify StatAlert to allow 57 cacheservers to function with 57+ agent
  // However, update of a new StatAlertDefn on 57 server from 57+ agent not covered with this
  DataSerializer.writePrimitiveInt(this.getDefinitionId(), out);
  DataSerializer.writeDate(this.getTime(), out);
  DataSerializer.writeObjectArray(this.getValues(), out);

  DataSerializer.writeString(this.memberId, out);
}
 
Example #22
Source Project: big-c   Author: yncxcw   File: GenericWritable.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  if (type == NOT_SET || instance == null)
    throw new IOException("The GenericWritable has NOT been set correctly. type="
                          + type + ", instance=" + instance);
  out.writeByte(type);
  instance.write(out);
}
 
Example #23
Source Project: gemfirexd-oss   Author: gemxd   File: SQLChar.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void toData(DataOutput out) throws IOException {
  if (!isNull()) {
    out.writeByte(getTypeId());
    writeData(out, true);
    return;
  }
  this.writeNullDVD(out);
}
 
Example #24
Source Project: gemfirexd-oss   Author: gemxd   File: TradePortfolioHdfsDataVerifier.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  System.out.println("writing Portfolio cid: " + cid + " sid: " + sid + " qty: " + qty + " availQty: " + availQty + " subTotal: " + subTotal.toPlainString()  + " tid: " +  tid);
  out.writeInt(cid);
  out.writeInt(sid);
  out.writeInt(tid);
  out.writeInt(qty);
  out.writeInt(availQty);
  out.writeUTF(subTotal.toPlainString());
  
}
 
Example #25
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: ZoneRules.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes the state the ZoneOffset to the stream.
 *
 * @param offset  the offset, not null
 * @param out  the output stream, not null
 * @throws IOException if an error occurs
 */
static void writeOffset(ZoneOffset offset, DataOutput out) throws IOException {
    final int offsetSecs = offset.getTotalSeconds();
    int offsetByte = offsetSecs % 900 == 0 ? offsetSecs / 900 : 127;  // compress to -72 to +72
    out.writeByte(offsetByte);
    if (offsetByte == 127) {
        out.writeInt(offsetSecs);
    }
}
 
Example #26
Source Project: vxquery   Author: apache   File: SubtractOperation.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void operateDTDurationDTDuration(LongPointable longp1, LongPointable longp2, DataOutput dOut)
        throws SystemException, IOException {
    long value = longp1.longValue();
    value -= longp2.longValue();
    dOut.write(ValueTag.XS_DAY_TIME_DURATION_TAG);
    dOut.writeLong(value);
}
 
Example #27
Source Project: data-polygamy   Author: VIDA-NYU   File: FrameworkUtils.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
    // spatial
    out.writeInt(this.spatial);
    
    // temporal
    out.writeInt(this.temporal);
    
    // attribute
    out.writeFloat(this.value);
}
 
Example #28
Source Project: coming   Author: SpoonLabs   File: jMutRepair_0051_t.java    License: MIT License 4 votes vote down vote up
public void writeTo(DataOutput out) throws IOException {
    writeMillis(out, iStandardOffset);
    iStartRecurrence.writeTo(out);
    iEndRecurrence.writeTo(out);
}
 
Example #29
Source Project: gemfirexd-oss   Author: gemxd   File: ExpirationAttributes.java    License: Apache License 2.0 4 votes vote down vote up
public void toData(DataOutput out) throws IOException {
  out.writeInt(this.timeout);
  DataSerializer.writeObject(this.action, out);
}
 
Example #30
Source Project: spork   Author: sigmoidanalytics   File: ExampleTuple.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
    t.write(out);
    out.writeBoolean(synthetic);
    out.writeBoolean(omittable);
}