本文整理匯總了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());
}