本文整理汇总了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());
}
}
}
}
示例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);
}
示例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);
}
示例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());
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例13: toData
import java.io.DataOutput; //导入方法依赖的package包/类
public void toData(DataOutput out) throws IOException {
DataSerializer.writeProperties(this.resolveProps, out);
out.writeInt(this.numBuckets);
}
示例14: writeNode
import java.io.DataOutput; //导入方法依赖的package包/类
public void writeNode(EvolutionState state, DataOutput output) throws IOException {
output.writeInt(value2);
}
示例15: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
out.writeInt(bytesPerCRC);
out.writeLong(crcPerBlock);
md5.write(out);
}