List of usage examples for java.io ObjectOutput writeInt
void writeInt(int v) throws IOException;
int
value, which is comprised of four bytes, to the output stream. From source file:com.splicemachine.derby.impl.sql.execute.operations.scanner.TableScannerBuilder.java
@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(template);/*from w w w . jav a 2 s .co m*/ writeScan(out); out.writeBoolean(rowColumnMap != null); if (rowColumnMap != null) { out.writeInt(rowColumnMap.length); //noinspection ForLoopReplaceableByForEach for (int i = 0; i < rowColumnMap.length; ++i) { out.writeInt(rowColumnMap[i]); } } writeTxn(out); ArrayUtil.writeIntArray(out, keyColumnEncodingOrder); out.writeBoolean(keyColumnSortOrder != null); if (keyColumnSortOrder != null) { ArrayUtil.writeBooleanArray(out, keyColumnSortOrder); } ArrayUtil.writeIntArray(out, keyColumnTypes); out.writeBoolean(keyDecodingMap != null); if (keyDecodingMap != null) { ArrayUtil.writeIntArray(out, keyDecodingMap); } out.writeBoolean(baseColumnMap != null); if (baseColumnMap != null) { ArrayUtil.writeIntArray(out, baseColumnMap); } out.writeObject(accessedKeys); out.writeBoolean(reuseRowLocation); out.writeBoolean(oneSplitPerRegion); out.writeBoolean(indexName != null); if (indexName != null) out.writeUTF(indexName); out.writeBoolean(tableVersion != null); if (tableVersion != null) out.writeUTF(tableVersion); out.writeBoolean(fieldLengths != null); if (fieldLengths != null) { out.writeInt(fieldLengths.length); //noinspection ForLoopReplaceableByForEach for (int i = 0; i < fieldLengths.length; ++i) { out.writeInt(fieldLengths[i]); } out.writeInt(columnPositionMap.length); //noinspection ForLoopReplaceableByForEach for (int i = 0; i < columnPositionMap.length; ++i) { out.writeInt(columnPositionMap[i]); } out.writeLong(baseTableConglomId); } out.writeLong(demarcationPoint); out.writeBoolean(optionalProbeValue != null); if (optionalProbeValue != null) out.writeObject(optionalProbeValue); out.writeBoolean(pin); writeNullableString(delimited, out); writeNullableString(escaped, out); writeNullableString(lines, out); writeNullableString(storedAs, out); writeNullableString(location, out); }
From source file:ArraySet.java
public final void writeExternal(final ObjectOutput out) throws IOException { out.writeInt(listTable.length); out.writeInt(size);/* ww w .jav a 2 s . c o m*/ for (int i = 0; i < size; i++) { out.writeObject(listTable[i].key); out.writeObject(listTable[i].value); } }
From source file:com.px100systems.util.serialization.SerializationDefinition.java
/** * Externalizable helper - should be used in Externalizable implementations. * @param out output//w ww. j a v a2s. c o m * @param bean bean */ public void write(ObjectOutput out, Object bean) { DataStream ds = new DataStream(); try { write(ds, bean); byte[] data = ds.getData(); out.writeInt(data.length); out.write(data); } catch (IOException e) { throw new RuntimeException(e); } finally { ds.close(); } }
From source file:SequencedHashMap.java
/** * Serializes this map to the given stream. * * @param out the stream to serialize to * @throws IOException if the stream raises it *//*from w ww . ja v a2s.com*/ public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(size()); for (Entry pos = sentinel.next; pos != sentinel; pos = pos.next) { out.writeObject(pos.getKey()); out.writeObject(pos.getValue()); } }
From source file:org.openide.windows.TopComponent.java
/** Serialize this top component. * Subclasses wishing to store state must call the super method, then write to the stream. * @param out the stream to serialize to/* w ww. j a v a 2s . c o m*/ */ public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(new Short(serialVersion)); out.writeInt(closeOperation); out.writeObject(getName()); out.writeObject(getToolTipText()); Node.Handle h = nodeName == null ? null : nodeName.node.getHandle(); out.writeObject(h); }
From source file:es.udc.gii.common.eaf.algorithm.population.Individual.java
/** * This method is called whenever an instance of this class has to be serialized.<p> * //from w w w.j a va 2 s . c om * It might write to the output <code>out</code> the evaluation results * or the genotype information or both, deppending on the value of * Individual#getSerializeEvalResults and Individual#getSerializeGenotype, * which are always writen at the beginning of the output to know later what * type of information is contained in the data.<p> * * Subclasses should override this method if they introduce new attibutes. * Remember to call <code>super.writeExternal()</code> in order to * be sure that the state of the parent class is serialized. * * @param out - DataOutput to write the serialized bytes to. * @throws java.io.IOException */ @Override public void writeExternal(ObjectOutput out) throws IOException { /* Phenotype serialized? */ out.writeBoolean(this.serializeEvalResults); /* Genotype serialized? */ out.writeBoolean(this.serializeGenotype); if (this.serializeEvalResults) { /* Serialize number of violated constraints */ out.writeInt(this.violatedConstraints); /* Serialize fitness */ out.writeDouble(this.fitness); /* Serialize objective values */ if (this.objectives == null) { out.writeInt(-1); } else { out.writeInt(this.objectives.size()); for (Double d : this.objectives) { out.writeDouble(d.doubleValue()); } } /* Serialize constraint values */ if (this.constraints == null) { out.writeInt(-1); } else { out.writeInt(this.constraints.size()); for (Double d : this.constraints) { out.writeDouble(d.doubleValue()); } } } if (this.serializeGenotype) { /* Serialize the chromosomes */ if (this.chromosomes == null) { out.writeInt(-1); } else { out.writeInt(this.chromosomes.length); for (int i = 0; i < this.chromosomes.length; i++) { int genes = this.chromosomes[i].getNumElements(); out.writeInt(genes); for (int j = 0; j < genes; j++) { out.writeDouble(this.chromosomes[i].getElement(j)); } } } } }
From source file:xbird.xquery.dm.instance.DocumentTableModel.java
public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(_docid); out.writeObject(_store); }
From source file:org.opencms.db.CmsPublishList.java
/** * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput) *//*from ww w . ja va2 s.c o m*/ public void writeExternal(ObjectOutput out) throws IOException { // write the history id out.write(m_publishHistoryId.toByteArray()); // write the project id out.write((m_projectId != null) ? m_projectId.toByteArray() : CmsUUID.getNullUUID().toByteArray()); // write the flags out.writeInt((m_publishSiblings) ? 1 : 0); out.writeInt((m_publishSubResources) ? 1 : 0); // write the list of direct publish resources by writing the uuid of each resource if (m_directPublishResources != null) { out.writeInt(m_directPublishResources.size()); for (Iterator<CmsResource> i = m_directPublishResources.iterator(); i.hasNext();) { out.write((i.next()).getStructureId().toByteArray()); } } else { out.writeInt(NIL); } // write the list of published files by writing the uuid of each resource if (m_fileList != null) { out.writeInt(m_fileList.size()); for (Iterator<CmsResource> i = m_fileList.iterator(); i.hasNext();) { out.write((i.next()).getStructureId().toByteArray()); } } else { out.writeInt(NIL); } // write the list of published folders by writing the uuid of each resource if (m_folderList != null) { out.writeInt(m_folderList.size()); for (Iterator<CmsResource> i = m_folderList.iterator(); i.hasNext();) { out.write((i.next()).getStructureId().toByteArray()); } } else { out.writeInt(NIL); } // write the list of deleted folders by writing the uuid of each resource if (m_deletedFolderList != null) { out.writeInt(m_deletedFolderList.size()); for (Iterator<CmsResource> i = m_deletedFolderList.iterator(); i.hasNext();) { out.write((i.next()).getStructureId().toByteArray()); } } else { out.writeInt(NIL); } }
From source file:org.perf.log.logger.PerfLogData.java
@Override public void writeExternal(ObjectOutput out) throws IOException { // write out the desired fields out.writeLong(getTransactionTime()); writeStr(getGuid(), out);/* w ww. j a v a 2 s.com*/ writeStr(getSessionId(), out); writeStr(getThreadName(), out); writeStr(getThreadId(), out); if (getTransactionDate() != null) out.writeLong(getTransactionDate().getTime()); else out.writeLong(new Date().getTime()); writeStr(getServerName(), out); writeStr(getServerIp(), out); writeStr(getCloneName(), out); out.writeInt(getJvmDepth()); out.writeInt(getTxnFilterDepth()); writeStr(getTransactionType(), out); writeStr(getUserId(), out); writeStr(getTransactionName(), out); writeStr(getSubTransactionName(), out); writeStr(getTransactionClass(), out); writeStr(getInfoContextString(), out); writeStr(getMessage(), out); writeStr(getThrowableClassName(), out); writeStr(getThrowableMessage(), out); }
From source file:com.inmobi.grill.server.query.QueryExecutionServiceImpl.java
@Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); // persist all drivers synchronized (drivers) { out.writeInt(drivers.size()); for (GrillDriver driver : drivers) { out.writeUTF(driver.getClass().getName()); driver.writeExternal(out);/*from w ww . j a v a 2 s. co m*/ } } // persist allQueries synchronized (allQueries) { out.writeInt(allQueries.size()); for (QueryContext ctx : allQueries.values()) { out.writeObject(ctx); boolean isDriverAvailable = (ctx.getSelectedDriver() != null); out.writeBoolean(isDriverAvailable); if (isDriverAvailable) { out.writeUTF(ctx.getSelectedDriver().getClass().getName()); } } } LOG.info("Persisted " + allQueries.size() + " queries"); }