Java Code Examples for java.io.ObjectOutputStream#writeUTF()
The following examples show how to use
java.io.ObjectOutputStream#writeUTF() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: HotswapAgent File: AppletServer.java License: GNU General Public License v2.0 | 6 votes |
private void lookupName(String cmd, InputStream ins, OutputStream outs) throws IOException { ObjectInputStream in = new ObjectInputStream(ins); String name = DataInputStream.readUTF(in); ExportedObject found = exportedNames.get(name); outs.write(okHeader); ObjectOutputStream out = new ObjectOutputStream(outs); if (found == null) { logging2(name + "not found."); out.writeInt(-1); // error code out.writeUTF("error"); } else { logging2(name); out.writeInt(found.identifier); out.writeUTF(found.object.getClass().getName()); } out.flush(); out.close(); in.close(); }
Example 2
Source Project: flink File: RemoteRpcInvocation.java License: Apache License 2.0 | 6 votes |
private void writeObject(ObjectOutputStream oos) throws IOException { oos.writeUTF(methodName); oos.writeInt(parameterTypes.length); for (Class<?> parameterType : parameterTypes) { oos.writeObject(parameterType); } if (args != null) { oos.writeBoolean(true); for (int i = 0; i < args.length; i++) { try { oos.writeObject(args[i]); } catch (IOException e) { throw new IOException("Could not serialize " + i + "th argument of method " + methodName + ". This indicates that the argument type " + args.getClass().getName() + " is not serializable. Arguments have to " + "be serializable for remote rpc calls.", e); } } } else { oos.writeBoolean(false); } }
Example 3
Source Project: android_tv_metro File: DiskBasedCache.java License: Apache License 2.0 | 6 votes |
/** * Writes the contents of this CacheHeader to the specified OutputStream. */ public boolean writeHeader(OutputStream os) { try { ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeByte(CACHE_VERSION); oos.writeUTF(key); oos.writeUTF(etag == null ? "" : etag); oos.writeLong(serverDate); oos.writeLong(ttl); oos.writeLong(softTtl); writeStringStringMap(responseHeaders, oos); oos.flush(); return true; } catch (IOException e) { VolleyLog.d("%s", e.toString()); return false; } }
Example 4
Source Project: visualvm File: HeapHistogramResponse.java License: GNU General Public License v2.0 | 5 votes |
void writeObject(ObjectOutputStream out) throws IOException { out.writeLong(time.getTime()); out.writeInt(newNames.length); for (int i = 0; i < newNames.length; i++) { out.writeUTF(newNames[i]); } out.writeInt(newids.length); for (int i = 0; i < newids.length; i++) { out.writeInt(newids[i]); } out.writeInt(ids.length); for (int i = 0; i < ids.length; i++) { out.writeInt(ids[i]); } out.writeInt(instances.length); for (int i = 0; i < instances.length; i++) { out.writeLong(instances[i]); } out.writeInt(bytes.length); for (int i = 0; i < bytes.length; i++) { out.writeLong(bytes[i]); } newNames = null; newids = null; ids = null; instances = null; bytes = null; }
Example 5
Source Project: CupDnn File: InputLayer.java License: BSD 2-Clause "Simplified" License | 5 votes |
@Override public void saveModel(ObjectOutputStream out) { // TODO Auto-generated method stub try { out.writeUTF(getType()); //�����ʱ��batchҲ����layerParams��number����1����Ϊpredict��ʱ����Ϊ����ʹ�õ�ʱ�����batchһ�㶼��1 out.writeInt(width); out.writeInt(height); out.writeInt(channel); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
Example 6
Source Project: phrasal File: RichTranslation.java License: GNU General Public License v3.0 | 5 votes |
/** * Custom serializer. * * @param oos */ private void writeObject(ObjectOutputStream oos) throws IOException { oos.defaultWriteObject(); oos.writeLong(latticeSourceId); oos.writeDouble(score); oos.writeUTF(source.toString()); oos.writeUTF(translation.toString()); oos.writeUTF(f2eAlignment == null ? alignmentString() : f2eAlignment); oos.writeObject(this.features); }
Example 7
Source Project: Flink-CEPplus File: HCatInputFormatBase.java License: Apache License 2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeInt(this.fieldNames.length); for (String fieldName : this.fieldNames) { out.writeUTF(fieldName); } this.configuration.write(out); }
Example 8
Source Project: logging-log4j2 File: StringFormattedMessage.java License: Apache License 2.0 | 5 votes |
private void writeObject(final ObjectOutputStream out) throws IOException { out.defaultWriteObject(); getFormattedMessage(); out.writeUTF(formattedMessage); out.writeUTF(messagePattern); out.writeInt(argArray.length); stringArgs = new String[argArray.length]; int i = 0; for (final Object obj : argArray) { final String string = String.valueOf(obj); stringArgs[i] = string; out.writeUTF(string); ++i; } }
Example 9
Source Project: kogito-runtimes File: ProcessInstanceResolverStrategy.java License: Apache License 2.0 | 5 votes |
public void write(ObjectOutputStream os, Object object) throws IOException { ProcessInstance processInstance = (ProcessInstance) object; connectProcessInstanceToRuntimeAndProcess( processInstance, os ); os.writeUTF( processInstance.getId() ); }
Example 10
Source Project: flink File: HCatInputFormatBase.java License: Apache License 2.0 | 5 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeInt(this.fieldNames.length); for (String fieldName : this.fieldNames) { out.writeUTF(fieldName); } this.configuration.write(out); }
Example 11
Source Project: super-cloudops File: IamSession.java License: Apache License 2.0 | 5 votes |
/** * Serializes this object to the specified output stream for JDK * Serialization. * * @param out * output stream used for Object serialization. * @throws IOException * if any of this object's fields cannot be written to the * stream. * @since 1.0 */ @JsonIgnore private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); short alteredFieldsBitMask = getAlteredFieldsBitMask(); out.writeShort(alteredFieldsBitMask); if (id != null) { out.writeObject(id); } if (startTimestamp != null) { out.writeObject(startTimestamp); } if (stopTimestamp != null) { out.writeObject(stopTimestamp); } if (lastAccessTime != null) { out.writeObject(lastAccessTime); } if (timeout != 0l) { out.writeLong(timeout); } if (expired) { out.writeBoolean(expired); } if (host != null) { out.writeUTF(host); } if (!CollectionUtils.isEmpty(attributes)) { out.writeObject(attributes); } }
Example 12
Source Project: barleydb File: ToManyNode.java License: GNU Lesser General Public License v3.0 | 5 votes |
private void writeObject(ObjectOutputStream oos) throws IOException { LOG.trace("Serializing many references {}", this); oos.writeUTF(entityType.getInterfaceName()); oos.writeBoolean(fetched); oos.writeObject(entities); oos.writeObject(newEntities); }
Example 13
Source Project: dragonwell8_jdk File: ActivationID.java License: GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }
Example 14
Source Project: netbeans File: MonitoredNumbersResponse.java License: Apache License 2.0 | 4 votes |
void writeObject(ObjectOutputStream out) throws IOException { out.writeInt(mode); for (int i = 0; i < generalNumbers.length; i++) { out.writeLong(generalNumbers[i]); } if (mode == CommonConstants.MODE_THREADS_SAMPLING) { out.writeInt(nThreads); out.writeInt(nThreadStates); for (int i = 0; i < nThreads; i++) { out.writeInt(threadIds[i]); } for (int i = 0; i < nThreadStates; i++) { out.writeLong(stateTimestamps[i]); } int len = nThreads * nThreadStates; out.write(threadStates, 0, len); } else if (mode == CommonConstants.MODE_THREADS_EXACT) { out.writeInt(exactThreadStates.length); for (int i = 0; i < exactThreadIds.length; i++) { out.writeInt(exactThreadIds[i]); out.writeByte(exactThreadStates[i]); out.writeLong(exactTimeStamps[i]); } } if (nNewThreads == 0) { out.writeInt(0); } else { out.writeInt(nNewThreads); for (int i = 0; i < nNewThreads; i++) { out.writeInt(newThreadIds[i]); out.writeUTF(newThreadNames[i]); out.writeUTF(newThreadClassNames[i]); } } out.writeInt(gcStarts.length); for (int i = 0; i < gcStarts.length; i++) { out.writeLong(gcStarts[i]); } out.writeInt(gcFinishs.length); for (int i = 0; i < gcFinishs.length; i++) { out.writeLong(gcFinishs[i]); } out.writeInt(serverState); out.writeInt(serverProgress); }
Example 15
Source Project: coming File: Cardumen_00189_t.java License: MIT License | 4 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeUTF(iID); }
Example 16
Source Project: coming File: Cardumen_0074_s.java License: MIT License | 4 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.writeUTF(iID); }
Example 17
Source Project: bcm-android File: PrefixedChecksummedBytes.java License: GNU General Public License v3.0 | 4 votes |
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeUTF(params.getId()); }
Example 18
Source Project: netbeans File: GetDefiningClassLoaderCommand.java License: Apache License 2.0 | 4 votes |
void writeObject(ObjectOutputStream out) throws IOException { out.writeUTF(className); out.writeInt(classLoaderId); }
Example 19
Source Project: webarchive-commons File: UsableURI.java License: Apache License 2.0 | 4 votes |
private void writeObject(ObjectOutputStream stream) throws IOException { stream.writeUTF(toCustomString()); }
Example 20
Source Project: openjdk-jdk8u-backup File: ActivationID.java License: GNU General Public License v2.0 | 4 votes |
/** * <code>writeObject</code> for custom serialization. * * <p>This method writes this object's serialized form for * this class as follows: * * <p>The <code>writeObject</code> method is invoked on * <code>out</code> passing this object's unique identifier * (a {@link java.rmi.server.UID UID} instance) as the argument. * * <p>Next, the {@link * java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput) * getRefClass} method is invoked on the activator's * <code>RemoteRef</code> instance to obtain its external ref * type name. Next, the <code>writeUTF</code> method is * invoked on <code>out</code> with the value returned by * <code>getRefClass</code>, and then the * <code>writeExternal</code> method is invoked on the * <code>RemoteRef</code> instance passing <code>out</code> * as the argument. * * @serialData The serialized data for this class comprises a * <code>java.rmi.server.UID</code> (written with * <code>ObjectOutput.writeObject</code>) followed by the * external ref type name of the activator's * <code>RemoteRef</code> instance (a string written with * <code>ObjectOutput.writeUTF</code>), followed by the * external form of the <code>RemoteRef</code> instance as * written by its <code>writeExternal</code> method. * * <p>The external ref type name of the * <code>RemoteRef</Code> instance is * determined using the definitions of external ref type * names specified in the {@link java.rmi.server.RemoteObject * RemoteObject} <code>writeObject</code> method * <b>serialData</b> specification. Similarly, the data * written by the <code>writeExternal</code> method and read * by the <code>readExternal</code> method of * <code>RemoteRef</code> implementation classes * corresponding to each of the defined external ref type * names is specified in the {@link * java.rmi.server.RemoteObject RemoteObject} * <code>writeObject</code> method <b>serialData</b> * specification. **/ private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { out.writeObject(uid); RemoteRef ref; if (activator instanceof RemoteObject) { ref = ((RemoteObject) activator).getRef(); } else if (Proxy.isProxyClass(activator.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(activator); if (!(handler instanceof RemoteObjectInvocationHandler)) { throw new InvalidObjectException( "unexpected invocation handler"); } ref = ((RemoteObjectInvocationHandler) handler).getRef(); } else { throw new InvalidObjectException("unexpected activator type"); } out.writeUTF(ref.getRefClass(out)); ref.writeExternal(out); }