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 File: ColGroupDDC2.java    From systemds with 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 #2
Source File: jMutRepair_0051_s.java    From coming with 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 #3
Source File: SnapshotFSImageFormat.java    From big-c with 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 #4
Source File: ColumnProjectionFilter.java    From phoenix with 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 #5
Source File: RemoteOperationMessage.java    From gemfirexd-oss with 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 #6
Source File: SubtractOperation.java    From vxquery with 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 #7
Source File: NamespaceInfo.java    From RDFS with 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 #8
Source File: TradePortfolioHdfsDataVerifier.java    From gemfirexd-oss with 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 #9
Source File: InternalDataSerializer.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.writeNonPrimitiveClassName(this.className, out);
  out.writeInt(this.id);
  DataSerializer.writeObject(this.eventId, out);
}
 
Example #10
Source File: DistributedCacheOperation.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);
  // 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 #11
Source File: FxRate.java    From gemfirexd-oss with 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 #12
Source File: FrameworkUtils.java    From data-polygamy with 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 #13
Source File: ZoneRules.java    From openjdk-jdk8u-backup with 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 #14
Source File: SQLChar.java    From gemfirexd-oss with 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 #15
Source File: FrameworkUtils.java    From data-polygamy with 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 #16
Source File: GenericWritable.java    From big-c with 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 #17
Source File: RawLocalFileSystem.java    From big-c with 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 #18
Source File: TradesHdfsDataVerifierV2.java    From gemfirexd-oss with 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 #19
Source File: StatAlertNotification.java    From gemfirexd-oss with 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 #20
Source File: SubtractOperation.java    From vxquery with 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 #21
Source File: Bucket.java    From xmrwallet with 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 #22
Source File: RowKeyValueAccessor.java    From phoenix with 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 #23
Source File: BucketServerLocation66.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.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 #24
Source File: jKali_0030_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 #25
Source File: ManagementProtocolHeader.java    From wildfly-core with 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 #26
Source File: BinarySchema.java    From ignite with 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 #27
Source File: GfxdJarMessage.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);

  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 #28
Source File: ModOperation.java    From vxquery with Apache License 2.0 4 votes vote down vote up
@Override
public void operateFloatDTDuration(FloatPointable floatp, LongPointable longp, DataOutput dOut)
        throws SystemException, IOException {
    throw new SystemException(ErrorCode.XPTY0004);
}
 
Example #29
Source File: SnapshotFSImageFormat.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public static void saveFileDiffList(final INodeFile file,
    final DataOutput out) throws IOException {
  saveINodeDiffs(file.getDiffs(), out, null);
}
 
Example #30
Source File: DistributionAdvisor.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public void toData(DataOutput out) throws IOException {
  InternalDataSerializer.invokeToData(this.peerMemberId, out);
  out.writeInt(this.version);
  out.writeInt(this.serialNumber);
}