Example usage for java.io ObjectOutputStream writeDouble

List of usage examples for java.io ObjectOutputStream writeDouble

Introduction

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

Prototype

public void writeDouble(double val) throws IOException 

Source Link

Document

Writes a 64 bit double.

Usage

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

private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeInt(featureCount);/*  ww  w.  java2s  . c  o  m*/
    out.writeInt(userCount);
    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:com.projity.pm.task.TaskSnapshot.java

public void serialize(ObjectOutputStream s) throws IOException {
    currentSchedule.serialize(s);/*from   w w w  . ja  v a2s.c  o m*/
    //s.writeObject(hasAssignments);
    s.writeDouble(fixedCost);
    s.writeInt(fixedCostAccrual);
    s.writeBoolean(ignoreResourceCalendar);
    s.writeInt(hasAssignments.getSchedulingType());
    s.writeBoolean(hasAssignments.isEffortDriven());
}

From source file:com.projity.pm.criticalpath.TaskSchedule.java

public void serialize(ObjectOutputStream s) throws IOException {
    s.writeDouble(percentComplete);
    s.writeLong(rawDuration);//from ww  w.  j ava2s .co m
    s.writeLong(start);
    s.writeLong(finish);
}

From source file:org.rlcommunity.environment.octopus.messages.OctopusCoreDataResponse.java

@Override
public String makeStringResponse() {
    ObjectOutputStream OOS = null;
    try {//from w ww. j  ava 2s  .c  om
        StringBuffer theResponseBuffer = new StringBuffer();
        theResponseBuffer.append("TO=");
        theResponseBuffer.append(MessageUser.kBenchmark.id());
        theResponseBuffer.append(" FROM=");
        theResponseBuffer.append(MessageUser.kEnv.id());
        theResponseBuffer.append(" CMD=");
        theResponseBuffer.append(EnvMessageType.kEnvResponse.id());
        theResponseBuffer.append(" VALTYPE=");
        theResponseBuffer.append(MessageValueType.kString.id());
        theResponseBuffer.append(" VALS=");
        ByteArrayOutputStream BOS = new ByteArrayOutputStream();
        OOS = new ObjectOutputStream(new BufferedOutputStream(BOS));
        OOS.writeObject(theTargets);
        OOS.writeDouble(theSurfaceLevel);
        OOS.close();
        byte[] theStringBytes = BOS.toByteArray();
        byte[] b64encoded = Base64.encodeBase64(theStringBytes);
        String theBytesAsString = new String(b64encoded);
        theResponseBuffer.append(theBytesAsString);
        return theResponseBuffer.toString();
    } catch (IOException ex) {
        Logger.getLogger(OctopusCoreDataResponse.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        try {
            OOS.close();
        } catch (IOException ex) {
            Logger.getLogger(OctopusCoreDataResponse.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return null;

}

From source file:fr.pasteque.pos.ticket.TicketInfo.java

/** Serialize as shared ticket */
public byte[] serialize() throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream(2048);
    ObjectOutputStream out = new ObjectOutputStream(bos);
    out.writeObject(m_sId);//from   ww  w.ja  va  2s. c  om
    out.writeInt(tickettype);
    out.writeInt(m_iTicketId);
    out.writeObject(m_Customer);
    out.writeObject(m_dDate);
    out.writeObject(attributes);
    out.writeObject(m_aLines);
    out.writeObject(this.customersCount);
    out.writeObject(this.tariffAreaId);
    out.writeObject(this.discountProfileId);
    out.writeDouble(this.discountRate);
    out.flush();
    byte[] data = bos.toByteArray();
    out.close();
    return data;
}

From source file:org.bigtextml.topics.ParallelTopicModel.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeInt(CURRENT_SERIAL_VERSION);

    //This part needs to be re-written
    /*/*w  w w . j  a v  a2s  .co m*/
    out.writeObject(data);
    out.writeObject(alphabet);
    out.writeObject(topicAlphabet);
    */

    out.writeObject(data);
    out.writeObject(alphabet);
    out.writeObject(topicAlphabet);

    out.writeInt(numTopics);

    out.writeInt(topicMask);
    out.writeInt(topicBits);

    out.writeInt(numTypes);

    out.writeObject(alpha);
    out.writeDouble(alphaSum);
    out.writeDouble(beta);
    out.writeDouble(betaSum);

    out.writeObject(typeTopicCounts);
    out.writeObject(tokensPerTopic);

    out.writeObject(docLengthCounts);
    out.writeObject(topicDocCounts);

    out.writeInt(numIterations);
    out.writeInt(burninPeriod);
    out.writeInt(saveSampleInterval);
    out.writeInt(optimizeInterval);
    out.writeInt(showTopicsInterval);
    out.writeInt(wordsPerTopic);

    out.writeInt(saveStateInterval);
    out.writeObject(stateFilename);

    out.writeInt(saveModelInterval);
    out.writeObject(modelFilename);

    out.writeInt(randomSeed);
    out.writeObject(formatter);
    out.writeBoolean(printLogLikelihood);

    out.writeInt(numThreads);
}