Example usage for java.io ObjectInputStream readLong

List of usage examples for java.io ObjectInputStream readLong

Introduction

In this page you can find the example usage for java.io ObjectInputStream readLong.

Prototype

public long readLong() throws IOException 

Source Link

Document

Reads a 64 bit long.

Usage

From source file:org.largecollections.LargeCacheMap.java

private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    this.folder = (String) in.readObject();
    this.name = (String) in.readObject();
    this.cacheSize = in.readInt();
    this.dbComparatorCls = (String) in.readObject();
    this.size = in.readInt();
    this.longSize = in.readLong();
    this.createDB();
    sdUtils = new SerializationUtils<K, V>();

}

From source file:org.pentaho.reporting.engine.classic.core.Element.java

/**
 * A helper method that deserializes a object from the given stream.
 *
 * @param stream/*ww w. j  a  va  2  s  .c  o m*/
 *          the stream from which to read the object data.
 * @throws IOException
 *           if an IO error occured.
 * @throws ClassNotFoundException
 *           if an referenced class cannot be found.
 */
private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.attributes = new ReportAttributeMap<Object>(stream.readLong());
    final String[] nameSpaces = (String[]) stream.readObject();
    for (int i = 0; i < nameSpaces.length; i++) {
        final String nameSpace = nameSpaces[i];
        final String[] names = (String[]) stream.readObject();
        for (int j = 0; j < names.length; j++) {
            final String name = names[j];
            final int nullHandler = stream.readByte();
            if (nullHandler == 0) {
                final Object attribute = SerializerHelper.getInstance().readObject(stream);
                this.attributes.setAttribute(nameSpace, name, attribute);
            }
        }
    }
}

From source file:org.protempa.proposition.TemporalProposition.java

/**
 * Called while deserializing a temporal proposition.
 * /*from  w  ww .  j a v a 2 s  . co  m*/
 * @param s
 *            an {@link ObjectInputStream}.
 * @throws IOException
 *             input/output error during deserialization.
 * @throws ClassNotFoundException
 *             class of a serialized object cannot be found.
 */
protected void readTemporalProposition(ObjectInputStream s) throws IOException, ClassNotFoundException {
    int mode = s.readChar();
    try {
        switch (mode) {
        case 0:
            setInterval(INTERVAL_FACTORY.getInstance(s.readLong(), (Granularity) s.readObject()));
            break;
        case 1:
            setInterval(INTERVAL_FACTORY.getInstance(s.readLong(), (Granularity) s.readObject(), s.readLong(),
                    (Granularity) s.readObject()));
            break;
        case 2:
            setInterval(INTERVAL_FACTORY.getInstance((Long) s.readObject(), (Long) s.readObject(),
                    (Granularity) s.readObject(), (Long) s.readObject(), (Long) s.readObject(),
                    (Granularity) s.readObject()));
            break;
        default:
            throw new InvalidObjectException("Can't restore. Invalid mode: " + mode);
        }
    } catch (IllegalArgumentException iae) {
        throw new InvalidObjectException("Can't restore: " + iae.getMessage());
    }
}

From source file:org.sventon.cache.direntrycache.CompassDirEntryCache.java

/**
 * Loads the latest cached revision number from disk.
 *
 * @throws CacheException if unable to read file.
 *///ww w  .j a v  a  2  s .c  om
private void loadLatestCachedRevisionNumber() throws CacheException {
    logger.info("Loading file from disk, " + latestCachedRevisionFile);
    ObjectInputStream inputStream = null;
    if (latestCachedRevisionFile.exists()) {
        try {
            inputStream = new ObjectInputStream(new FileInputStream(latestCachedRevisionFile));
            setLatestCachedRevisionNumber(inputStream.readLong());
            logger.debug("Revision: " + getLatestCachedRevisionNumber());
        } catch (IOException ex) {
            throw new CacheException("Unable to read file from disk", ex);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    }
}

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

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    cdaSettingsId = (String) in.readObject();
    dataAccessId = (String) in.readObject();
    queryDurationMs = in.readLong();
    nbrRows = in.readInt();//w  w w.  ja  v  a2s  .c om
    entryTime = in.readLong();
    timeToLive = in.readInt();

    try {
        tableSnapshot = new JSONObject((String) in.readObject());
    } catch (Exception e) {
        tableSnapshot = null;
    }
}