本文整理汇总了Java中java.io.DataOutput.writeUTF方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutput.writeUTF方法的具体用法?Java DataOutput.writeUTF怎么用?Java DataOutput.writeUTF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataOutput
的用法示例。
在下文中一共展示了DataOutput.writeUTF方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toData
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
short flags = 0;
if (this.processorId != 0)
flags |= HAS_PROCESSOR_ID;
if (this.ttl != 0)
flags |= HAS_TTL;
if (this.idleTime != 0)
flags |= HAS_IDLE_TIME;
out.writeShort(flags);
if (this.processorId != 0) {
out.writeInt(this.processorId);
}
out.writeUTF(this.regionName);
DataSerializer.writeObject(this.key, out);
out.writeInt(this.timeoutMs);
if (this.ttl != 0) {
InternalDataSerializer.writeSignedVL(this.ttl, out);
}
if (this.idleTime != 0) {
InternalDataSerializer.writeSignedVL(this.idleTime, out);
}
}
示例2: serialize
import java.io.DataOutput; //导入方法依赖的package包/类
public void serialize(DataOutput buf, WeaponData data) throws IOException {
buf.writeByte(this.id);
switch (type) {
case BOOLEAN:
buf.writeBoolean(getBoolean(data));
break;
case INTEGER:
buf.writeInt(getInt(data));
break;
case DOUBLE:
buf.writeFloat(getFloat(data));
break;
case STRING:
buf.writeUTF(getString(data));
break;
default:
}
}
示例3: 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);
}
示例4: writeStrings
import java.io.DataOutput; //导入方法依赖的package包/类
private void writeStrings(DataOutput dos, Collection<String> set)
throws IOException {
if (set == null) {
dos.writeInt(0);
return;
}
dos.writeInt(set.size());
for (String s : set) {
dos.writeUTF(s);
}
}
示例5: doWritePath
import java.io.DataOutput; //导入方法依赖的package包/类
private static void doWritePath(String codeName, String relPath, Object out) throws IOException {
if (out instanceof DataOutput) {
DataOutput dos = (DataOutput) out;
dos.writeUTF(codeName);
dos.writeUTF(relPath);
} else {
Collection coll = (Collection) out;
coll.add(codeName);
coll.add(relPath);
}
}
示例6: write
import java.io.DataOutput; //导入方法依赖的package包/类
public void write(DataOutput out)
throws IOException {
boolean hasMessage = (message != null && message.length() > 0);
out.writeBoolean(hasMessage);
if (hasMessage) {
out.writeUTF(message);
}
}
示例7: writeTag
import java.io.DataOutput; //导入方法依赖的package包/类
private static void writeTag(NBTBase tag, DataOutput output) throws IOException
{
output.writeByte(tag.getId());
if (tag.getId() != 0)
{
output.writeUTF("");
tag.write(output);
}
}
示例8: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
out.writeInt(this.id);
out.writeInt(this.year);
out.writeInt(this.season);
out.writeInt(this.month);
out.writeInt(this.week);
out.writeInt(this.day);
out.writeUTF(this.type);
out.writeLong(this.calendar.getTime());
}
示例9: writeExternal
import java.io.DataOutput; //导入方法依赖的package包/类
void writeExternal(DataOutput out) throws IOException {
out.writeUTF(getId());
}
示例10: write
import java.io.DataOutput; //导入方法依赖的package包/类
/**
* Write the actual data contents of the tag, implemented in NBT extension classes
*/
void write(DataOutput output) throws IOException
{
output.writeUTF(this.data);
}
示例11: writeJavaVersion
import java.io.DataOutput; //导入方法依赖的package包/类
protected void writeJavaVersion(final DataOutput out) throws IOException {
out.writeUTF(ObjectUtils.defaultIfNull(getJavaVersion(), ""));
}
示例12: toDelta
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void toDelta(DataOutput out) throws IOException {
out.writeUTF(this.value);
}
示例13: writeExternal
import java.io.DataOutput; //导入方法依赖的package包/类
void writeExternal(DataOutput out) throws IOException {
out.writeUTF(id);
}
示例14: writeExternal
import java.io.DataOutput; //导入方法依赖的package包/类
void writeExternal(DataOutput out) throws IOException {
out.writeUTF(chrono.getId());
out.writeInt(years);
out.writeInt(months);
out.writeInt(days);
}
示例15: writeStream
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void writeStream(final DataOutput data, final T value) throws IOException
{
data.writeUTF(toJson(value).toString());
}