Example usage for java.io ObjectOutputStream writeInt

List of usage examples for java.io ObjectOutputStream writeInt

Introduction

In this page you can find the example usage for java.io ObjectOutputStream writeInt.

Prototype

public void writeInt(int val) throws IOException 

Source Link

Document

Writes a 32 bit int.

Usage

From source file:webplugin.WebAddress.java

public void writeData(ObjectOutputStream out) throws IOException {
    out.writeInt(3);

    out.writeObject(mName);/*w  w w.jav  a 2s . c  o m*/
    out.writeObject(mIconFileName);
    out.writeObject(mUrl);
    out.writeBoolean(mUserEntry);
    out.writeBoolean(mActive);
}

From source file:ConcurrentHashSet.java

/**
 * /*  w  w  w.j  a  v  a2  s  .  c o  m*/
 * @param s
 * @throws java.io.IOException
 */
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
    s.defaultWriteObject();
    s.writeInt(map.size());

    for (Iterator<E> i = map.keySet().iterator(); i.hasNext();) {
        s.writeObject(i.next());
    }
}

From source file:org.archive.modules.net.RobotsExclusionPolicy.java

/** If object is DENYALL or ALLOWALL, only the object identity and type
 * is written in the serialization stream.
 *
 * @param stream the serialization stream.
 * @throws IOException /*from  ww  w  .  ja  va2 s .c o  m*/
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.writeInt(type.ordinal());
    if (type == Type.NORMAL) {
        stream.defaultWriteObject();
    }
}

From source file:com.cyberway.issue.crawler.datamodel.RobotsExclusionPolicy.java

/** If object is DENYALL or ALLOWALL, only the object identity and type
 * is written in the serialization stream.
 *
 * @param stream the serialization stream.
 * @throws IOException //w ww  .j  a va  2s  . c  om
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.writeInt(type);
    if (type == NORMAL_TYPE) {
        stream.defaultWriteObject();
    }
}

From source file:org.lenskit.mf.MFModel.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeInt(featureCount);
    out.writeInt(userCount);/*from  ww  w . j a va2s  .c  om*/
    out.writeInt(itemCount);

    for (int i = 0; i < userCount; i++) {
        for (int j = 0; j < featureCount; j++) {
            out.writeDouble(userMatrix.getEntry(i, j));
        }
    }

    for (int i = 0; i < itemCount; i++) {
        for (int j = 0; j < featureCount; j++) {
            out.writeDouble(itemMatrix.getEntry(i, j));
        }
    }

    out.writeObject(userIndex);
    out.writeObject(itemIndex);
}

From source file:mitm.application.djigzo.james.EncryptedContainer.java

private void writeObject(ObjectOutputStream out) throws IOException, EncryptorException {
    out.writeLong(serialVersionUID);/*from www  .ja v  a 2 s. co m*/

    byte[] encrypted = getEncryptor().encrypt(SerializationUtils.serialize(value));

    out.writeInt(ArrayUtils.getLength(encrypted));
    out.write(encrypted);
}

From source file:com.hp.autonomy.hod.client.api.textindex.query.search.Document.java

/**
 * @param objectOutputStream The output stream
 * @serialData Writes out the standard fields, then the number of non-standard fields {@code int}, followed by
 * the non-standard field names alternated with their values
 *///ww  w.ja v a2s .  co m
private void writeObject(final ObjectOutputStream objectOutputStream) throws IOException {
    objectOutputStream.defaultWriteObject();

    objectOutputStream.writeInt(fields.size());

    for (final Map.Entry<String, Serializable> entry : fields.entrySet()) {
        objectOutputStream.writeObject(entry.getKey());
        objectOutputStream.writeObject(entry.getValue());
    }
}

From source file:pt.webdetails.cda.cache.monitor.ExtraCacheInfo.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cdaSettingsId);/*from ww  w  .ja v  a2 s .  c  o  m*/
    out.writeObject(dataAccessId);
    out.writeLong(queryDurationMs);
    out.writeInt(nbrRows);
    out.writeLong(entryTime);
    out.writeInt(timeToLive);
    out.writeObject(tableSnapshot != null ? tableSnapshot.toString() : null);
}

From source file:it.scoppelletti.programmerpower.wui.DefaultActivity.java

/**
 * Serializza l&rsquo;oggetto./*from   w ww . j  a v  a2s . com*/
 * 
 * @param      out Flusso di scrittura.
 * @serialData     Formato di default seguito dall&rsquo;elenco delle
 *                 categorie:
 *
 * <P><OL>
 * <LI>Numero di categorie.
 * <LI>Sequenza di categorie.
 * </OL></P>
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    if (myCategories == null) {
        out.writeInt(-1);
    } else {
        out.writeInt(myCategories.size());
        for (String catg : myCategories) {
            out.writeObject(catg);
        }
    }
}

From source file:uk.ac.ebi.fg.jobs.JobController.java

/**
 * Retrieves ontology distance calculator object from file or creates new object in case EFO version or
 * ontology distance is different to file
 *
 * @param efo                 currently used EFO
 * @param maxOntologyDistance maximal ontology distance for ontology term distance calculations
 * @param fileLocation//w w  w  . j a  v  a2  s  . c om
 * @return
 * @throws Exception
 */
private OntologyDistanceCalculator getOntologyDistanceCalculator(IEFO efo, int maxOntologyDistance,
        String fileLocation) throws Exception {
    String version = efo.getVersionInfo();
    OntologyDistanceCalculator distCalc = null;

    File ontDistFile = new File(fileLocation);

    if (ontDistFile.exists()) {
        FileInputStream fis = new FileInputStream(ontDistFile);
        ObjectInputStream ois = new ObjectInputStream(fis);

        if ((ois.readInt() == maxOntologyDistance) && (ois.readUTF().equals(version))) {
            logger.info("Precalculated ontology distance file found for version " + version + " and distance "
                    + maxOntologyDistance);

            distCalc = (OntologyDistanceCalculator) ois.readObject();

            logger.info("\'ontology distance calculator\' object retrieved from file");
        }
        ois.close();
    }
    if (null == distCalc) {
        logger.info("Matching precalculated ontology distance file not found.");
        distCalc = new OntologyDistanceCalculator(efo, maxOntologyDistance);

        logger.info("Creating file " + ontDistFile);
        FileOutputStream fos = new FileOutputStream(ontDistFile);
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeInt(maxOntologyDistance);
        oos.writeUTF(version);
        oos.writeObject(distCalc);

        oos.close();
        logger.info("File " + ontDistFile + " successfully created");
    }

    return distCalc;
}