Java Code Examples for java.io.ObjectOutputStream.writeLong()

The following are Jave code examples for showing how to use writeLong() of the java.io.ObjectOutputStream class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: SamplesOutputStream.java   View Source Code Vote up 6 votes
void close() throws IOException {
    steCache = null;
    GZIPOutputStream stream = new GZIPOutputStream(outStream, 64 * 1024);
    ObjectOutputStream out = new ObjectOutputStream(stream);
    int size = samples.size();
    out.writeInt(size);
    out.writeLong(getSample(size-1).getTime());
    openProgress();
    for (int i=0; i<size;i++) {
        Sample s = getSample(i);
        removeSample(i);
        if (i > 0 && i % RESET_THRESHOLD == 0) {
            out.reset();
        }
        s.writeToStream(out);
        if ((i+40) % 50 == 0) step((STEPS*i)/size);
    }
    step(STEPS); // set progress at 100%
    out.close();
    closeProgress();
}
 
Example 2
Project: openjdk-jdk10   File: Longs.java   View Source Code Vote up 6 votes
/**
 * Run benchmark for given number of batches, with given number of cycles
 * for each batch.
 */
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
            StreamBuffer sbuf, int nbatches, int ncycles)
    throws Exception
{
    for (int i = 0; i < nbatches; i++) {
        sbuf.reset();
        for (int j = 0; j < ncycles; j++) {
            oout.writeLong(0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readLong();
        }
    }
}
 
Example 3
Project: TPlayer   File: SerializableCookie.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.expiresAt());
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
    out.writeBoolean(cookie.persistent());
}
 
Example 4
Project: jdk8u-jdk   File: CustomObjTrees.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
Example 5
Project: basicapp   File: SerializableCookie.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.persistent() ? cookie.expiresAt() : NON_VALID_EXPIRES_AT);
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
}
 
Example 6
Project: incubator-netbeans   File: SamplesOutputStream.java   View Source Code Vote up 5 votes
private void writeToStream(ObjectOutputStream out) throws IOException {
    out.writeLong(time);
    out.writeInt(sameThread.size());
    for (Long tid : sameThread) {
        out.writeLong(tid.longValue());
    }
    out.writeInt(newThreads.size());
    for (ThreadInfo tic : newThreads) {
        out.writeObject(toCompositeData(tic));
    }
}
 
Example 7
Project: incubator-netbeans   File: HeapHistogramResponse.java   View Source Code Vote up 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 8
Project: incubator-netbeans   File: VMPropertiesResponse.java   View Source Code Vote up 5 votes
void writeObject(ObjectOutputStream out) throws IOException {
    out.writeInt(agentVersion);
    out.writeUTF(jdkVersionString);
    out.writeUTF(javaClassPath);
    out.writeUTF(javaExtDirs);
    out.writeUTF(bootClassPath);
    out.writeUTF(workingDir);
    out.writeUTF(jvmArguments);
    out.writeUTF(javaCommand);
    out.writeUTF(targetMachineOSName);
    out.writeLong(maxHeapSize);
    out.writeLong(startupTimeMillis);
    out.writeLong(startupTimeInCounts);
    out.writeInt(agentId);
}
 
Example 9
Project: morpheus-core   File: DenseArrayOfZonedDateTimes.java   View Source Code Vote up 5 votes
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        final long value = values[index];
        os.writeLong(value);
        if (value != defaultValueAsLong) {
            os.writeShort(zoneIds[index]);
        }
    }
}
 
Example 10
Project: openjdk-jdk10   File: CustomObjTrees.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
Example 11
Project: graphflow   File: EdgeStore.java   View Source Code Vote up 5 votes
@Override
public void serializeMainFile(ObjectOutputStream objectOutputStream) throws IOException {
    objectOutputStream.writeInt(data.length);
    objectOutputStream.writeLong(nextIDNeverYetAssigned);
    objectOutputStream.writeByte(nextBucketOffset);
    objectOutputStream.writeInt(nextBucketId);
    objectOutputStream.writeInt(nextPartitionId);
    objectOutputStream.writeInt(recycledIdsSize);
    objectOutputStream.writeObject(recycledIds);
}
 
Example 12
Project: stynico   File: SerializableHttpCookie.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.expiresAt());
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
    out.writeBoolean(cookie.persistent());
}
 
Example 13
Project: lqrwechatrongcloud   File: SerializableCookie.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.persistent() ? cookie.expiresAt() : NON_VALID_EXPIRES_AT);
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
}
 
Example 14
Project: XinFramework   File: EntityCookie.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeObject(cookie.name());
    out.writeObject(cookie.value());
    out.writeLong(cookie.expiresAt());
    out.writeObject(cookie.domain());
    out.writeObject(cookie.path());
    out.writeBoolean(cookie.secure());
    out.writeBoolean(cookie.httpOnly());
    out.writeBoolean(cookie.hostOnly());
    out.writeBoolean(cookie.persistent());
}
 
Example 15
Project: XSnow   File: OkHttpCookies.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookies.name());
    out.writeObject(cookies.value());
    out.writeLong(cookies.expiresAt());
    out.writeObject(cookies.domain());
    out.writeObject(cookies.path());
    out.writeBoolean(cookies.secure());
    out.writeBoolean(cookies.httpOnly());
    out.writeBoolean(cookies.hostOnly());
    out.writeBoolean(cookies.persistent());
}
 
Example 16
Project: morpheus-core   File: DenseArrayOfZonedDateTimes.java   View Source Code Vote up 5 votes
/** Custom serialization */
private void writeObject(ObjectOutputStream os) throws IOException {
    final int length = values.length;
    os.writeInt(length);
    os.writeLong(defaultValueAsLong);
    os.writeObject(defaultValue);
    for (int i=0; i<length; ++i) {
        os.writeLong(values[i]);
        os.writeShort(zoneIds[i]);
    }
}
 
Example 17
Project: QSHttp   File: SerializableOkHttpCookies.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeObject(cookies.name());
    out.writeObject(cookies.value());
    out.writeLong(cookies.expiresAt());
    out.writeObject(cookies.domain());
    out.writeObject(cookies.path());
    out.writeBoolean(cookies.secure());
    out.writeBoolean(cookies.httpOnly());
    out.writeBoolean(cookies.hostOnly());
    out.writeBoolean(cookies.persistent());
}
 
Example 18
Project: buffer-slayer   File: LongAdderV8.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
    s.writeLong(sum());
}
 
Example 19
Project: googles-monorepo-demo   File: LongAdder.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
    s.writeLong(sum());
}
 
Example 20
Project: incubator-netbeans   File: MonitoredNumbersResponse.java   View Source Code Vote up 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);
}