当前位置: 首页>>代码示例>>Java>>正文


Java DataOutput.writeInt方法代码示例

本文整理汇总了Java中java.io.DataOutput.writeInt方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutput.writeInt方法的具体用法?Java DataOutput.writeInt怎么用?Java DataOutput.writeInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.DataOutput的用法示例。


在下文中一共展示了DataOutput.writeInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeSetOfLongs

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * write a set of Long objects
 * 
 * @param set the set of Long objects
 * @param hasLongIDs if false, write only ints, not longs
 * @param out the output stream
 */
public static void writeSetOfLongs(Set set, boolean hasLongIDs, DataOutput out)
    throws IOException {
  if (set == null) {
    out.writeInt(-1);
  } else {
    out.writeInt(set.size());
    out.writeBoolean(hasLongIDs);
    for (Iterator it = set.iterator(); it.hasNext();) {
      Long l = (Long) it.next();
      if (hasLongIDs) {
        out.writeLong(l.longValue());
      } else {
        out.writeInt((int) l.longValue());
      }
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:InternalDataSerializer.java

示例2: writeEssentialData

import java.io.DataOutput; //导入方法依赖的package包/类
public void writeEssentialData(DataOutput out) throws IOException {
  Version.writeOrdinal(out, this.versionOrdinal, true);

  int flags = 0;
  if (networkPartitionDetectionEnabled)
    flags |= NPD_ENABLED_BIT;
  if (preferredForCoordinator)
    flags |= PREFERRED_FOR_COORD_BIT;
  out.writeShort(flags);

  DataSerializer.writeInetAddress(inetAddr, out);
  out.writeInt(udpPort);
  out.writeInt(vmViewId);
  out.writeLong(uuidMSBs);
  out.writeLong(uuidLSBs);

}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:GMSMember.java

示例3: toData

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  out.writeInt(this.keys.size());
  for (Object key : keys) {
    DataSerializer.writeObject(key, out);
  }
  DataSerializer.writeObject(this.eventID, out);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:10,代码来源:PRTombstoneMessage.java

示例4: writeExternal

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * Writes the state to the stream.
 *
 * @param out  the output stream, not null
 * @throws IOException if an error occurs
 */
void writeExternal(DataOutput out) throws IOException {
    final int timeSecs = (timeEndOfDay ? 86400 : time.toSecondOfDay());
    final int stdOffset = standardOffset.getTotalSeconds();
    final int beforeDiff = offsetBefore.getTotalSeconds() - stdOffset;
    final int afterDiff = offsetAfter.getTotalSeconds() - stdOffset;
    final int timeByte = (timeSecs % 3600 == 0 ? (timeEndOfDay ? 24 : time.getHour()) : 31);
    final int stdOffsetByte = (stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255);
    final int beforeByte = (beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3);
    final int afterByte = (afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3);
    final int dowByte = (dow == null ? 0 : dow.getValue());
    int b = (month.getValue() << 28) +          // 4 bits
            ((dom + 32) << 22) +                // 6 bits
            (dowByte << 19) +                   // 3 bits
            (timeByte << 14) +                  // 5 bits
            (timeDefinition.ordinal() << 12) +  // 2 bits
            (stdOffsetByte << 4) +              // 8 bits
            (beforeByte << 2) +                 // 2 bits
            afterByte;                          // 2 bits
    out.writeInt(b);
    if (timeByte == 31) {
        out.writeInt(timeSecs);
    }
    if (stdOffsetByte == 255) {
        out.writeInt(stdOffset);
    }
    if (beforeByte == 3) {
        out.writeInt(offsetBefore.getTotalSeconds());
    }
    if (afterByte == 3) {
        out.writeInt(offsetAfter.getTotalSeconds());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:ZoneOffsetTransitionRule.java

示例5: saveRegistrations

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * Persist this class's map to out
 */
public static void saveRegistrations(DataOutput out) throws IOException {
  for (Instantiator inst : InternalInstantiator.getInstantiators()) {
    out.writeInt(inst.getId());
    DataSerializer.writeClass(inst.getClass(), out);
    DataSerializer.writeClass(inst.getInstantiatedClass(), out);
  }
  // We know that Instantiator id's must not be 0 so write a zero
  // to mark then end of the instantiators.
  out.writeInt(0);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:InternalInstantiator.java

示例6: toData

import java.io.DataOutput; //导入方法依赖的package包/类
public void toData(DataOutput out) throws IOException {
  out.writeInt(offlineMembers.length);
  for (Set<PersistentMemberID> set : offlineMembers) {
    out.writeInt(set.size());
    for (PersistentMemberID id : set) {
      InternalDataSerializer.invokeToData(id, out);
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:10,代码来源:OfflineMemberDetailsImpl.java

示例7: toData

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  DataSerializer.writeString(this.regionPath, out);
  DataSerializer.writeObject(this.profile, out);
  out.writeInt(this.processorId);
  out.writeBoolean(this.concurrencyChecksEnabled);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:CreateRegionProcessor.java

示例8: writeBlocks

import java.io.DataOutput; //导入方法依赖的package包/类
private static void writeBlocks(final Block[] blocks,
    final DataOutput out) throws IOException {
  if (blocks == null) {
    out.writeInt(0);
  } else {
    out.writeInt(blocks.length);
    for (Block blk : blocks) {
      blk.write(out);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:FSImageSerialization.java

示例9: writePayload

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
protected void writePayload(DataOutput output, ByteBuffer header, boolean shrink)
    throws IOException {
  super.writePayload(output, header, shrink);
  output.writeInt(namespace);
  output.writeInt(name);
}
 
开发者ID:xyxyLiu,项目名称:AndResM,代码行数:8,代码来源:XmlEndElementChunk.java

示例10: toData

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toData(DataOutput out) throws IOException {
  super.toData(out);
  DataSerializer.writeString(this.regionPath, out);
  out.writeInt(this.processorId);
  out.writeBoolean(this.targetReinitialized);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:8,代码来源:InitialImageOperation.java

示例11: writeHostPortFormat

import java.io.DataOutput; //导入方法依赖的package包/类
/**
 * Write endpoint to output stream in older format used by
 * UnicastRef for JDK1.1 compatibility.
 */
public void writeHostPortFormat(DataOutput out) throws IOException {
    if (csf != null) {
        throw new InternalError("TCPEndpoint.writeHostPortFormat: " +
            "called for endpoint with non-null socket factory");
    }
    out.writeUTF(host);
    out.writeInt(port);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TCPEndpoint.java

示例12: toData

import java.io.DataOutput; //导入方法依赖的package包/类
public void toData(DataOutput out) throws IOException {
  DataSerializer.writeString(this.className, out);
  {
    // pre 8.1 we wrote a single boolean
    // 8.1 and after we write a byte whose bits are:
    // 1: noDomainClass
    // 2: hasDeletedField
    byte bits = 0;
    if (this.noDomainClass) {
      bits |= NO_DOMAIN_CLASS_BIT;
    }
    // Note that this code attempts to only set the HAS_DELETED_FIELD_BIT
    // if serializing for 8.1 or later.
    // But in some cases 8.1 serialized data may be sent to a pre 8.1 member.
    // In that case if this bit is set it will cause the pre 8.1 member
    // to set noDomainClass to true.
    // For this reason the pdx delete-field command should only be used after
    // all member have been upgraded to 8.1 or later.
    Version sourceVersion = InternalDataSerializer.getVersionForDataStream(out);
    if (sourceVersion.compareTo(Version.GFE_81) >= 0) {
      if (this.hasDeletedField) {
        bits |= HAS_DELETED_FIELD_BIT;
      }
    }
    out.writeByte(bits);
  }

  out.writeInt(this.typeId);
  out.writeInt(this.vlfCount);

  InternalDataSerializer.writeArrayLength(this.fields.size(), out);

  for (int i = 0; i < this.fields.size(); i++) {

    PdxField vft = this.fields.get(i);
    vft.toData(out);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:39,代码来源:PdxType.java

示例13: toData

import java.io.DataOutput; //导入方法依赖的package包/类
public void toData(DataOutput out) throws IOException {
  DataSerializer.writeProperties(this.resolveProps, out);
  out.writeInt(this.numBuckets);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:5,代码来源:SingleHopQuarterPartitionResolver.java

示例14: writeNode

import java.io.DataOutput; //导入方法依赖的package包/类
public void writeNode(EvolutionState state, DataOutput output) throws IOException {
	output.writeInt(value2);
}
 
开发者ID:cryogenic-dreams,项目名称:StarCraft-GPBot,代码行数:4,代码来源:At.java

示例15: write

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
  out.writeInt(bytesPerCRC);
  out.writeLong(crcPerBlock);
  md5.write(out);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:MD5MD5CRC32FileChecksum.java


注:本文中的java.io.DataOutput.writeInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。