當前位置: 首頁>>代碼示例>>Java>>正文


Java DataOutput.writeUTF方法代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:27,代碼來源:SearchLoadAndWriteProcessor.java

示例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:
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:19,代碼來源:WeaponData.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:TCPEndpoint.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ModuleData.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:Stamps.java

示例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);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:10,代碼來源:ExternalWritable.java

示例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);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:CompressedStreamTools.java

示例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());
}
 
開發者ID:liuhaozzu,項目名稱:big_data,代碼行數:12,代碼來源:DateDimension.java

示例9: writeExternal

import java.io.DataOutput; //導入方法依賴的package包/類
void writeExternal(DataOutput out) throws IOException {
    out.writeUTF(getId());
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:4,代碼來源:AbstractChronology.java

示例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);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:NBTTagString.java

示例11: writeJavaVersion

import java.io.DataOutput; //導入方法依賴的package包/類
protected void writeJavaVersion(final DataOutput out) throws IOException {
  out.writeUTF(ObjectUtils.defaultIfNull(getJavaVersion(), ""));
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:4,代碼來源:LocatorStatusResponse.java

示例12: toDelta

import java.io.DataOutput; //導入方法依賴的package包/類
@Override
public void toDelta(DataOutput out) throws IOException {
  out.writeUTF(this.value);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:5,代碼來源:MultiVMRegionTestCase.java

示例13: writeExternal

import java.io.DataOutput; //導入方法依賴的package包/類
void writeExternal(DataOutput out) throws IOException {
    out.writeUTF(id);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:4,代碼來源:ZoneRegion.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:ChronoPeriodImpl.java

示例15: writeStream

import java.io.DataOutput; //導入方法依賴的package包/類
@Override
public void writeStream(final DataOutput data, final T value) throws IOException
{
    data.writeUTF(toJson(value).toString());
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE,代碼行數:6,代碼來源:AvancedDataType.java


注:本文中的java.io.DataOutput.writeUTF方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。