本文整理汇总了Java中java.io.DataOutputStream.writeUTF方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutputStream.writeUTF方法的具体用法?Java DataOutputStream.writeUTF怎么用?Java DataOutputStream.writeUTF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataOutputStream
的用法示例。
在下文中一共展示了DataOutputStream.writeUTF方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import java.io.DataOutputStream; //导入方法依赖的package包/类
public void write(final DataOutputStream dataOutputStream) {
try {
dataOutputStream.writeUTF(this.name);
doWriteFloatArray(dataOutputStream, this.boundingVolumeHierarchy);
doWriteFloatArray(dataOutputStream, this.camera);
doWriteFloatArray(dataOutputStream, this.point2s);
doWriteFloatArray(dataOutputStream, this.point3s);
doWriteFloatArray(dataOutputStream, this.shapes);
doWriteFloatArray(dataOutputStream, this.surfaces);
doWriteFloatArray(dataOutputStream, this.textures);
doWriteFloatArray(dataOutputStream, this.vector3s);
doWriteIntArray(dataOutputStream, this.shapeOffsets);
} catch(final IOException e) {
throw new UncheckedIOException(e);
}
}
示例2: initialConnect
import java.io.DataOutputStream; //导入方法依赖的package包/类
private static void initialConnect(Socket javaSocket, NetJavaSocketImpl gdxSocket) throws Exception {
javaSocket.setSoTimeout(TIMEOUT);
DataInputStream dataInputStream = new DataInputStream(javaSocket.getInputStream());
byte b = dataInputStream.readByte();
DataOutputStream dataOutputStream = new DataOutputStream(javaSocket.getOutputStream());
dataOutputStream.writeInt(Branding.VERSION_MAJOR);
dataOutputStream.writeInt(Branding.VERSION_MINOR);
dataOutputStream.writeInt(Branding.VERSION_POINT);
dataOutputStream.writeInt(Branding.VERSION_BUILD);
dataOutputStream.writeUTF(Branding.VERSION_HASH);
switch (b) {
case 0:
connect(javaSocket, gdxSocket, dataOutputStream, dataInputStream);
return;
case 1:
ping(javaSocket, gdxSocket, dataOutputStream, dataInputStream);
return;
default:
throw new IOException("Unrecognised connection code " + b);
}
}
示例3: writeTo
import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
* Writes the parameter set to an output stream
*
* @param os an output stream
* @throws java.io.IOException
*/
public void writeTo(OutputStream os)
throws IOException
{
DataOutputStream dos = new DataOutputStream(os);
dos.writeInt(N);
dos.writeInt(q);
dos.writeInt(d);
dos.writeInt(d1);
dos.writeInt(d2);
dos.writeInt(d3);
dos.writeInt(B);
dos.writeInt(basisType);
dos.writeDouble(beta);
dos.writeDouble(normBound);
dos.writeDouble(keyNormBound);
dos.writeInt(signFailTolerance);
dos.writeBoolean(primeCheck);
dos.writeBoolean(sparse);
dos.writeInt(bitsF);
dos.write(keyGenAlg);
dos.writeUTF(hashAlg.getAlgorithmName());
dos.write(polyType);
}
示例4: writeNetworkCellData
import java.io.DataOutputStream; //导入方法依赖的package包/类
private void writeNetworkCellData(OutputStream out, int cid, int lac, int mmc, int mnc) throws IOException {
DataOutputStream dataOutputStream = new DataOutputStream(out);
dataOutputStream.writeShort(21);
dataOutputStream.writeLong(0);
dataOutputStream.writeUTF("en");
dataOutputStream.writeUTF("Android");
dataOutputStream.writeUTF("1.0");
dataOutputStream.writeUTF("Web");
dataOutputStream.writeByte(27);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(3);
dataOutputStream.writeUTF("");
dataOutputStream.writeInt(cid);
dataOutputStream.writeInt(lac);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.writeInt(0);
dataOutputStream.flush();
}
示例5: encodeCertificate
import java.io.DataOutputStream; //导入方法依赖的package包/类
private void encodeCertificate(
Certificate cert,
DataOutputStream dOut)
throws IOException
{
try
{
byte[] cEnc = cert.getEncoded();
dOut.writeUTF(cert.getType());
dOut.writeInt(cEnc.length);
dOut.write(cEnc);
}
catch (CertificateEncodingException ex)
{
throw new IOException(ex.toString());
}
}
示例6: write
import java.io.DataOutputStream; //导入方法依赖的package包/类
public void write(DataOutputStream out) throws IOException {
if (value instanceof String) {
out.writeByte(CONSTANT_UTF8);
out.writeUTF((String) value);
} else if (value instanceof Integer) {
out.writeByte(CONSTANT_INTEGER);
out.writeInt(((Integer) value).intValue());
} else if (value instanceof Float) {
out.writeByte(CONSTANT_FLOAT);
out.writeFloat(((Float) value).floatValue());
} else if (value instanceof Long) {
out.writeByte(CONSTANT_LONG);
out.writeLong(((Long) value).longValue());
} else if (value instanceof Double) {
out.writeDouble(CONSTANT_DOUBLE);
out.writeDouble(((Double) value).doubleValue());
} else {
throw new InternalError("bogus value entry: " + value);
}
}
示例7: saveInternals
import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir,
final ExecutionMonitor exec)
throws IOException, CanceledExecutionException {
final String path = nodeInternDir.getAbsolutePath();
final File file = new File(path + "LoopEndNode.intern");
// save the defined classes
final DataOutputStream os =
new DataOutputStream(new FileOutputStream(file));
os.writeInt(m_classModel.getSize());
for (final String clsName : m_classModel.getDefinedClasses()) {
os.writeUTF(clsName);
}
os.close();
}
示例8: write
import java.io.DataOutputStream; //导入方法依赖的package包/类
public void write(DataOutputStream out, Object o) throws IOException
{
Compound compound = (Compound) o;
for(Map.Entry<String, Object> entry : compound.entrySet())
{
String name = entry.getKey();
Object e = entry.getValue();
TagType type = getType(e);
out.write(type.id);
out.writeUTF(name);
type.write(out, e);
}
out.write(0);
}
示例9: writeMessage
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
protected void writeMessage(OutputStream out) throws IOException {
super.writeMessage(out);
DataOutputStream dos = new DataOutputStream(out);
for (int i = 0; i < topics.size(); i++) {
dos.writeUTF(topics.get(i));
dos.write(topicQoSs.get(i).getValue());
}
dos.flush();
}
示例10: writeToEntropyPool
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
protected void writeToEntropyPool(DataOutputStream out) throws IOException {
super.writeToEntropyPool(out);
out.writeInt(android.os.Process.myPid());
out.writeInt(android.os.Process.myTid());
out.writeInt(android.os.Process.myUid());
if (Build.FINGERPRINT != null) out.writeUTF(Build.FINGERPRINT);
if (Build.SERIAL != null) out.writeUTF(Build.SERIAL);
ContentResolver contentResolver = appContext.getContentResolver();
String id = Settings.Secure.getString(contentResolver, ANDROID_ID);
if (id != null) out.writeUTF(id);
Parcel parcel = Parcel.obtain();
WifiManager wm =
(WifiManager) appContext.getSystemService(WIFI_SERVICE);
List<WifiConfiguration> configs = wm.getConfiguredNetworks();
if (configs != null) {
for (WifiConfiguration config : configs)
parcel.writeParcelable(config, 0);
}
BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
if (bt != null) {
for (BluetoothDevice device : bt.getBondedDevices())
parcel.writeParcelable(device, 0);
}
out.write(parcel.marshall());
parcel.recycle();
}
示例11: Save
import java.io.DataOutputStream; //导入方法依赖的package包/类
boolean Save(DataOutputStream F){ //Guarda la tupla al flujo F. Si hay error, return false.
try{
F.writeUTF(NombreID);
F.writeInt(ValorI);
F.writeInt(ValorF);
F.writeInt(CantTmp);
return true;
} catch(Exception e){}
return false;
}
示例12: sendQueuePosition
import java.io.DataOutputStream; //导入方法依赖的package包/类
private void sendQueuePosition(DataOutputStream out, int queued, String message)
throws IOException {
RobustMML mml = new RobustMML();
mml.put(QUEUED_PATH, "" + queued); //no queing
if (!message.equals(""))
mml.put(MESSAGE_PATH, message);
out.writeUTF("" + mml); //this would loop until 1
out.flush();
fireEvent(ServerDownloadEvent.QUEUED, queued);
}
示例13: save
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void save(DataOutputStream out) throws Exception
{
out.writeInt(id2tag.length);
for (String tag : id2tag)
{
out.writeUTF(tag);
}
FeatureFunction[] valueArray = featureFunctionTrie.getValueArray(new FeatureFunction[0]);
out.writeInt(valueArray.length);
for (FeatureFunction featureFunction : valueArray)
{
featureFunction.save(out);
}
featureFunctionTrie.save(out);
out.writeInt(featureTemplateList.size());
for (FeatureTemplate featureTemplate : featureTemplateList)
{
featureTemplate.save(out);
}
if (matrix != null)
{
out.writeInt(matrix.length);
for (double[] line : matrix)
{
for (double v : line)
{
out.writeDouble(v);
}
}
}
else
{
out.writeInt(0);
}
}
示例14: getBytesFromStrings
import java.io.DataOutputStream; //导入方法依赖的package包/类
public byte[] getBytesFromStrings(String[] addressesAsStrings) throws IOException {
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(byteOutputStream);
for (int i = 0; i < addressesAsStrings.length; i++) {
out.writeUTF(addressesAsStrings[i]);
}
out.writeUTF("");
return byteOutputStream.toByteArray();
}
示例15: store
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void store(FileSystem fs, List<URL> urls, OutputStream os) throws IOException {
DataOutputStream data = new DataOutputStream(os);
for (URL u : urls) {
data.writeUTF(u.toExternalForm());
}
data.close();
}