public void writeExternal(ObjectOutput out) throws IOException { out.writeByte(0); // reserved for future expansion (version id) out.writeShort(fieldNumber); if (header != null) writeHeader(out); if (packager != null) writePackager(out); if (direction > 0) writeDirection(out); // List keySet = new ArrayList (fields.keySet()); // Collections.sort (keySet); Iterator iter = fields.values().iterator(); while (iter.hasNext()) { ISOComponent c = (ISOComponent) iter.next(); if (c instanceof ISOMsg) { writeExternal(out, 'M', c); } else if (c instanceof ISOBinaryField) { writeExternal(out, 'B', c); } else if (c instanceof ISOAmount) { writeExternal(out, 'A', c); } else if (c instanceof ISOField) { writeExternal(out, 'F', c); } } out.writeByte('E'); }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { boolean done; boolean cancelled; Object res; Throwable err; boolean syncNotify; boolean concurNotify; synchronized (mux) { done = this.done; cancelled = this.cancelled; res = this.res; err = this.err; syncNotify = this.syncNotify; concurNotify = this.concurNotify; } out.writeBoolean(done); out.writeBoolean(syncNotify); out.writeBoolean(concurNotify); // Don't write any further if not done, as deserialized future // will be invalid anyways. if (done) { out.writeBoolean(cancelled); out.writeObject(res); out.writeObject(err); } }
protected void writePackager(ObjectOutput out) throws IOException { out.writeByte('P'); String pclass = packager.getClass().getName(); byte[] b = pclass.getBytes(); out.writeShort(b.length); out.write(b); }
// Implements Externalizable public void writeExternal(ObjectOutput out) throws IOException { // VERSION out.writeByte(0); // MAP out.writeObject(_map); }
/** * compare the byte-array representation of two TaskObjects. * * @param f TaskObject * @param s TaskObject * @return true if the two arguments have the same byte-array */ private boolean sameBytes(TaskObject f, TaskObject s) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(f); byte[] fs = bos.toByteArray(); out.writeObject(s); byte[] ss = bos.toByteArray(); if (fs.length != ss.length) return false; for (int i = 0; i < fs.length; i++) { if (fs[i] != ss[i]) return false; } return true; } catch (IOException e) { e.printStackTrace(); return false; } finally { if (out != null) { try { out.close(); } catch (IOException e) { // ignore } try { bos.close(); } catch (IOException e) { // ignore } } } }
protected void writeHeader(ObjectOutput out) throws IOException { int len = header.getLength(); if (len > 0) { out.writeByte('H'); out.writeShort(len); out.write(header.pack()); } }
public void writeExternal(final ObjectOutput out) throws IOException { out.writeByte(0); out.writeInt(this._size); final SerializationProcedure writeProcedure = new SerializationProcedure(out); if (!this.forEach(writeProcedure)) { throw writeProcedure.exception; } }
public void writeExternal(final ObjectOutput out) throws IOException { out.writeByte(1); out.writeInt(this._pos); final int len = this._pos; out.writeInt(this._pos); for (int i = 0; i < len; ++i) { out.writeShort(this._data[i]); } }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { U.writeString(out, jobName); U.writeString(out, user); out.writeBoolean(hasCombiner); out.writeInt(numReduces); U.writeStringMap(out, props); }
/** Serializes this <code>DataFlavor</code>. */ public synchronized void writeExternal(ObjectOutput os) throws IOException { if (mimeType != null) { mimeType.setParameter("humanPresentableName", humanPresentableName); os.writeObject(mimeType); mimeType.removeParameter("humanPresentableName"); } else { os.writeObject(null); } os.writeObject(representationClass); }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { GridUtils.writeUuid(out, nodeId); CU.writeVersion(out, ver); out.writeLong(timeout); out.writeLong(threadId); out.writeLong(id); out.writeShort(flags()); }
public void writeExternal(ObjectOutput out) { try { out.writeObject("LEVEL"); out.writeObject(new Integer(level)); out.writeObject("TIMESUSED"); out.writeObject(new Integer(timesUsed)); out.writeObject("SKILL END"); } catch (Exception e) { e.printStackTrace(); } }
// write data to server's database file private void updateFile(String file_name, Object data) { try { OutputStream file_data = new FileOutputStream(file_name); OutputStream buffer = new BufferedOutputStream(file_data); ObjectOutput data_out = new ObjectOutputStream(buffer); data_out.writeObject(data); data_out.close(); } catch (Exception e) { System.out.println("updateFile: Failed to update data to " + file_name); } }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeBoolean(depEnabled); if (depEnabled) { U.writeByteArray(out, topicBytes); U.writeByteArray(out, predBytes); U.writeString(out, clsName); out.writeObject(depInfo); } else { out.writeObject(topic); out.writeObject(pred); } }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeLong(threadId); out.writeBoolean(commit); out.writeBoolean(invalidate); out.writeBoolean(reply); U.writeGridUuid(out, futId); CU.writeVersion(out, commitVer); CU.writeVersion(out, baseVer); U.writeCollection(out, writeEntries); }
/** * @param out Output stream. * @param err Error cause. */ private void sendErrorResponse(ObjectOutput out, Exception err) { try { out.writeObject(new IpcSharedMemoryInitResponse(err)); } catch (IOException e) { U.error(log, "Failed to send error response to client.", e); } }
/** {@inheritDoc} */ public void writeExternal(ObjectOutput out) throws IOException { // VERSION out.writeByte(0); // SUPER super.writeExternal(out); // NUMBER OF ENTRIES out.writeInt(_size); // ENTRIES for (int i = _states.length; i-- > 0; ) { if (_states[i] == FULL) { out.writeInt(_set[i]); out.writeInt(_values[i]); } } }
public void writeExternal(ObjectOutput out) throws IOException { // esto es solo para serializar tickets que no estan en la bolsa de tickets pendientes out.writeObject(m_sId); out.writeInt(tickettype); out.writeInt(m_iTicketId); out.writeInt(m_iTicketNCF); // NCF out.writeObject(m_Customer); out.writeObject(m_dDate); out.writeObject(attributes); out.writeObject(m_aLines); }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { // VERSION out.writeByte(0); // SUPER super.writeExternal(out); // NUMBER OF ENTRIES out.writeInt(_size); // ENTRIES for (int i = capacity(); i-- > 0; ) { if (_states.get(i) == FULL) { out.writeChar(_set.get(i)); out.writeChar(_values.get(i)); } } }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { U.writeByteArray(out, src); out.writeInt(depMode.ordinal()); U.writeGridUuid(out, clsLdrId); U.writeString(out, srcClsName); U.writeString(out, userVer); U.writeMap(out, ldrParties); }
/** * @param out Object output. * @throws IOException If failed. */ @SuppressWarnings("TypeMayBeWeakened") private void writeFieldsCollection(ObjectOutput out) throws IOException { assert fields; out.writeInt(data != null ? data.size() : -1); if (data == null) return; for (Object o : data) { List<GridIndexingEntity<?>> list = (List<GridIndexingEntity<?>>) o; out.writeInt(list.size()); for (GridIndexingEntity<?> idxEnt : list) { try { out.writeObject(idxEnt.value()); } catch (GridSpiException e) { throw new IOException("Failed to write indexing entity: " + idxEnt, e); } } } }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); assert futId != null; assert miniId != null; assert ver != null; U.writeGridUuid(out, futId); U.writeGridUuid(out, miniId); U.writeCollection(out, entries); U.writeIntCollection(out, invalidParts); CU.writeVersion(out, ver); out.writeObject(err); }
public void write(ObjectOutput out, boolean useNewFormat) throws IOException { boolean isResultStream = false; if (out instanceof ConnectionOutputStream) { ConnectionOutputStream stream = (ConnectionOutputStream) out; isResultStream = stream.isResultStream(); /* * If this LiveRef is being marshalled as part of a return value, * then we have to worry about referential integrity being broken * while the reference is in transit, in case there no longer * remains a strong reference in this VM after the call has * completed. Therefore, we tell the stream to save a reference * until an acknowledgment has been received from the caller; for * "local" LiveRefs, save a reference to the impl directly, * because the impl is not reachable from this LiveRef (see * 4114579); otherwise, save a reference to the LiveRef, for the * client-side DGC to watch over (see 4017232 for more details). */ if (isResultStream) { if (isLocal) { Target target = ObjectTable.getTarget(id); if (target != null) { Remote impl = target.getImpl(); if (impl != null) { stream.saveObject(impl); } } } else { stream.saveObject(this); } } } // All together now write out the endpoint, id, and flag // (need to choose whether or not to use old JDK1.1 endpoint format) if (useNewFormat) { ((TCPEndpoint) ep).write(out); } else { ((TCPEndpoint) ep).writeHostPortFormat(out); } id.write(out); out.writeBoolean(isResultStream); }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeLong(topVer); out.writeBoolean(implicitTx); out.writeBoolean(implicitSingleTx); out.writeBoolean(syncCommit); out.writeBoolean(syncRollback); out.writeObject(filterBytes); U.writeArray(out, dhtVers); assert miniId != null; U.writeGridUuid(out, miniId); }
public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(base); out.writeInt(start); out.writeInt(end); }
/** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(key); out.writeObject(val); }
@Override public void writeExternal(ObjectOutput o) throws IOException { o.writeLong(serialVersionUID); writeTo(o); }
private void writeExternal(ObjectOutput out, char b, ISOComponent c) throws IOException { out.writeByte(b); ((Externalizable) c).writeExternal(out); }
private void writeTo(ObjectOutput o) throws IOException { o.writeInt(x); o.writeInt(y); o.writeInt(width); o.writeInt(height); o.writeInt(measuredWidth); o.writeInt(measuredHeight); o.writeInt(scrollX); o.writeInt(scrollY); o.writeInt(absoluteX); o.writeInt(absoluteY); o.writeFloat(cameraDistance); o.writeBoolean(visible); o.writeLong(drawingTime); o.writeBoolean(isShown); o.writeBoolean(hasFocus); o.writeBoolean(focusable); o.writeBoolean(hasOnClickListener); o.writeObject(viewType); o.writeObject(textContent); o.writeBoolean(isEditText); o.writeBoolean(isInputMethodTarget); o.writeBoolean(isContainer); o.writeInt(inputMethod); o.writeInt(id); if (children != null) { o.writeInt(children.size()); for (ViewComponentInfo child : children) { child.writeTo(o); } } else { o.writeInt(0); } }
protected void writeDirection(ObjectOutput out) throws IOException { out.writeByte('D'); out.writeByte(direction); }