本文整理汇总了Java中java.io.DataOutput.writeLong方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutput.writeLong方法的具体用法?Java DataOutput.writeLong怎么用?Java DataOutput.writeLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataOutput
的用法示例。
在下文中一共展示了DataOutput.writeLong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toData
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
out.writeByte(this.op.ordinal());
// out.writeLong(this.regionVersion);
out.writeInt(this.regionGCVersions.size());
boolean persistent = false;
if (!regionGCVersions.isEmpty()) {
VersionSource firstEntry = regionGCVersions.keySet().iterator().next();
if (firstEntry instanceof DiskStoreID) {
persistent = true;
}
}
out.writeBoolean(persistent);
for (Map.Entry<VersionSource, Long> entry : this.regionGCVersions.entrySet()) {
VersionSource member = entry.getKey();
if (member instanceof DiskStoreID) {
InternalDataSerializer.invokeToData((DiskStoreID) member, out);
} else {
((InternalDistributedMember) member).writeEssentialData(out);
}
out.writeLong(entry.getValue());
}
DataSerializer.writeObject(this.eventID, out);
}
示例2: toData
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
out.writeInt(this.processorId);
if (this.valueObj != null) {
DataSerializer.writeObjectAsByteArray(this.valueObj, out);
} else {
DataSerializer.writeByteArray(this.value, this.valueLen, out);
}
out.writeLong(this.lastModified);
byte booleans = 0;
if (this.isSerialized)
booleans |= SERIALIZED;
if (this.requestorTimedOut)
booleans |= REQUESTOR_TIMEOUT;
if (this.authoritative)
booleans |= AUTHORATIVE;
if (this.versionTag != null)
booleans |= VERSIONED;
if (this.versionTag instanceof DiskVersionTag)
booleans |= PERSISTENT;
out.writeByte(booleans);
if (this.versionTag != null) {
InternalDataSerializer.invokeToData(this.versionTag, out);
}
}
示例3: 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);
}
示例4: write
import java.io.DataOutput; //导入方法依赖的package包/类
public static void write(BigDecimal d, DataOutput out) throws IOException {
int scale = d.scale();
BigInteger bigIntPart = d.unscaledValue();
boolean fastpath = bigIntPart.compareTo(LONG_MAX_AS_BIGINT) < 0
&& bigIntPart .compareTo(LONG_MIN_AS_BIGINT) > 0;
out.writeInt(scale);
out.writeBoolean(fastpath);
if (fastpath) {
out.writeLong(bigIntPart.longValue());
} else {
Text.writeString(out, bigIntPart.toString());
}
}
示例5: writeLongArray
import java.io.DataOutput; //导入方法依赖的package包/类
/**
* Writes an array of <code>long</code>s to a <code>DataOutput</code>. This method will serialize
* a <code>null</code> array and not throw a <code>NullPointerException</code>.
*
* @throws IOException A problem occurs while writing to <code>out</code>
*
* @see #readLongArray
*/
public static void writeLongArray(long[] array, DataOutput out) throws IOException {
InternalDataSerializer.checkOut(out);
int length;
if (array == null) {
length = -1;
} else {
length = array.length;
}
InternalDataSerializer.writeArrayLength(length, out);
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER, "Writing long array of length {}", length);
}
if (length > 0) {
for (int i = 0; i < length; i++) {
out.writeLong(array[i]);
}
}
}
示例6: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override public void write(DataOutput out) throws IOException {
Bytes.writeByteArray(out, family);
Bytes.writeByteArray(out, qualifier);
// start
if (start == null) {
Bytes.writeByteArray(out, Bytes.toBytes(true));
} else {
Bytes.writeByteArray(out, Bytes.toBytes(false));
Bytes.writeByteArray(out, start);
Bytes.writeByteArray(out, Bytes.toBytes(startOp.toString()));
}
// stop
if (stop == null) {
Bytes.writeByteArray(out, Bytes.toBytes(true));
} else {
Bytes.writeByteArray(out, Bytes.toBytes(false));
Bytes.writeByteArray(out, stop);
Bytes.writeByteArray(out, Bytes.toBytes(stopOp.toString()));
}
out.writeLong(startTs);
out.writeLong(stopTs);
Bytes.writeByteArray(out, Bytes.toBytes(dataType.toString()));
}
示例7: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
out.writeLong(bytes);
out.writeInt(nLoc);
for (int i = 0; i < nLoc; ++i) {
Text.writeString(out, locations[i]);
}
}
示例8: write
import java.io.DataOutput; //导入方法依赖的package包/类
public void write(final DataOutput out) throws IOException {
Bytes.writeByteArray(out, this.columnFamily);
Bytes.writeByteArray(out, this.columnQualifier);
out.writeLong(this.startTs);
out.writeLong(this.endTs);
out.writeBoolean(foundColumn);
out.writeBoolean(filterIfMissing);
out.writeBoolean(latestVersionOnly);
}
示例9: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
out.writeLong(version);
if (methods == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
out.writeInt(methods.length);
for (int method : methods) {
out.writeInt(method);
}
}
}
示例10: writeRandom
import java.io.DataOutput; //导入方法依赖的package包/类
public void writeRandom(DataOutput out, final int size) throws IOException {
long tmp = seed;
out.writeLong(tmp);
int i = size - (Long.SIZE / Byte.SIZE);
while (i > Long.SIZE / Byte.SIZE - 1) {
tmp = nextRand(tmp);
out.writeLong(tmp);
i -= Long.SIZE / Byte.SIZE;
}
for (tmp = nextRand(tmp); i > 0; --i) {
out.writeByte((int)(tmp & 0xFF));
tmp >>>= Byte.SIZE;
}
}
示例11: toData
import java.io.DataOutput; //导入方法依赖的package包/类
/**
* Writes the contents of this object to the given output.
*/
public void toData(DataOutput out) throws IOException {
DataSerializer.writeObject(this.name, out);
DataSerializer.writeObject(this.lesseeThread.getDistributedMember(), out);
out.writeInt(this.lesseeThread.getThreadId());
out.writeInt(this.leaseId);
out.writeLong(this.leaseExpireTime);
}
示例12: writeAdditionalData
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void writeAdditionalData(DataOutput out) throws IOException {
out.writeLong(uuidMSBs);
out.writeLong(uuidLSBs);
out.write(memberWeight);
}
示例13: writeData
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void writeData(DataOutput output) throws IOException {
output.writeDouble(lastRate);
output.writeLong(lastTime);
}
示例14: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
Text.writeString(out, url);
Text.writeString(out, referrer);
out.writeLong(time);
}
示例15: toData
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
out.writeLong(this.lastModified);
}