Example usage for java.io ObjectInputStream readInt

List of usage examples for java.io ObjectInputStream readInt

Introduction

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

Prototype

public int readInt() throws IOException 

Source Link

Document

Reads a 32 bit int.

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:net.sf.nmedit.jpatch.ModuleDescriptions.java

@SuppressWarnings("unchecked")
public void readCache(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // signals//from   ww  w  .j  a  v  a  2 s  . c  o m
    signalTypes = (PSignalTypes) in.readObject();
    int size;
    // types
    size = in.readInt();
    for (int i = 0; i < size; i++) {
        String key = (String) in.readObject();
        PTypes<PType> t = (PTypes) in.readObject();
        types.put(key, t);
    }
    // modules
    size = in.readInt();
    for (int i = 0; i < size; i++) {
        PModuleDescriptor d = (PModuleDescriptor) in.readObject();
        ((PBasicModuleDescriptor) d).setModuleDescriptions(this);
        moduleMap.put(d.getComponentId(), d);
    }
}

From source file:org.largecollections.CacheMap.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.size = in.readInt();
    this.serdeUtils = (SerializationUtils<K, V>) in.readObject();
    this.bloomFilterSize = in.readInt();
    this.bloomFilter = (BloomFilter<K>) in.readObject();
    Map m = DBUtils.createDB(this.folder, this.name, this.cacheSize);
    this.db = (DB) m.get(Constants.DB_KEY);
    this.options = (Options) m.get(Constants.DB_OPTIONS_KEY);
    this.dbFile = (File) m.get(Constants.DB_FILE_KEY);
}

From source file:org.largecollections.FastIntIntCacheMap.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.size = in.readInt();
    this.bloomFilterSize = in.readInt();
    this.bloomFilter = (BloomFilter<Integer>) in.readObject();
    Map m = DBUtils.createDB(this.folder, this.name, this.cacheSize);
    this.db = (DB) m.get(Constants.DB_KEY);
    this.options = (Options) m.get(Constants.DB_OPTIONS_KEY);
    this.dbFile = (File) m.get(Constants.DB_FILE_KEY);
}

From source file:HashSet.java

/**
 * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.
 *///  w  ww . j  a  v a2  s  . co  m
@SuppressWarnings("unchecked")
protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    table = new Object[in.readInt()];
    int items = in.readInt();
    for (int i = 0; i < items; i++) {
        add((E) in.readObject());
    }
}

From source file:com.axiomine.largecollections.util.LargeCollection.java

protected void deserialize(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    this.dbPath = (String) in.readObject();
    this.dbName = (String) in.readObject();
    this.cacheSize = in.readInt();
    this.size = in.readInt();
    this.bloomFilterSize = in.readInt();
    this.bloomFilter = (BloomFilter<Integer>) in.readObject();

    //Override path here
    if (!StringUtils.isBlank(System.getProperty(OVERRIDE_DB_PATH))) {
        System.out.println("Overriding DBPath from System Property=" + System.getProperty(OVERRIDE_DB_PATH));
        this.dbPath = System.getProperty(OVERRIDE_DB_PATH);
    }//from   w  w w  .jav  a 2  s.  com
    if (!StringUtils.isBlank(System.getProperty(OVERRIDE_DB_NAME))) {
        System.out.println("Overriding DBName from System Property=" + System.getProperty(OVERRIDE_DB_NAME));
        this.dbName = System.getProperty(OVERRIDE_DB_NAME);
    }

    this.initialize(false);
    System.out.println("Now deserialized " + this.dbName);
}

From source file:com.blazeroni.reddit.http.SerializableCookie.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    String name = (String) in.readObject();
    String value = (String) in.readObject();
    BasicClientCookie c = new BasicClientCookie(name, value);
    c.setComment((String) in.readObject());
    c.setDomain((String) in.readObject());
    c.setExpiryDate((Date) in.readObject());
    c.setPath((String) in.readObject());
    c.setVersion(in.readInt());
    c.setSecure(in.readBoolean());// w w w . jav a2 s  .com

    this.cookie = c;
}

From source file:clipboardplugin.ClipboardPlugin.java

public void readData(ObjectInputStream in) throws IOException, ClassNotFoundException {
    try {//from  ww w .  j ava2 s.c  o  m
        in.readInt();

        int count = in.readInt();

        ArrayList<AbstractPluginProgramFormating> list = new ArrayList<AbstractPluginProgramFormating>(count);

        for (int i = 0; i < count; i++) {
            AbstractPluginProgramFormating value = AbstractPluginProgramFormating.readData(in);

            if (value != null) {
                if (value.equals(DEFAULT_CONFIG)) {
                    DEFAULT_CONFIG = (LocalPluginProgramFormating) value;
                }

                list.add(value);
            }
        }

        mConfigs = list.toArray(new AbstractPluginProgramFormating[Math.min(count, list.size())]);

        count = in.readInt();
        ArrayList<LocalPluginProgramFormating> listLocal = new ArrayList<LocalPluginProgramFormating>(count);

        for (int i = 0; i < count; i++) {
            LocalPluginProgramFormating value = (LocalPluginProgramFormating) AbstractPluginProgramFormating
                    .readData(in);

            if (value != null) {
                LocalPluginProgramFormating loadedInstance = getInstanceOfFormatingFromSelected(value);
                if (loadedInstance != null) {
                    listLocal.add(loadedInstance);
                } else {
                    listLocal.add(value);
                }
            }
        }
        mLocalFormatings = listLocal.toArray(new LocalPluginProgramFormating[Math.min(count, list.size())]);
    } catch (Exception e) {
        int i = 1;
    }
}

From source file:com.projity.interval.ValueObjectForIntervalTable.java

public void deserializeCompact(ObjectInputStream s) throws IOException, ClassNotFoundException {
    name = (String) s.readObject();
    int count = s.readInt();
    for (int i = 0; i < count; i++) {
        ValueObjectForInterval v = createValueObject();
        v.deserializeCompact(s, this);
        valueObjects.add(v);/* www  .jav  a 2 s  .co  m*/
    }
}

From source file:ddf.catalog.data.AttributeImpl.java

/**
 * Deserializes this {@link AttributeImpl}'s instance.
 * //from  w  ww  .  j  a va  2  s.com
 * @param stream
 *            the {@link ObjectInputStream} that contains the bytes of the
 *            object
 * @throws IOException
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {

    /*
     * defaultReadObject() is invoked for greater flexibility and
     * compatibility. See the *Serialization Note* in MetacardImpl's class
     * Javadoc.
     */
    s.defaultReadObject();

    int numElements = s.readInt();

    validateNonEmpty(numElements);

    values = new LinkedList<Serializable>();
    for (int i = 0; i < numElements; i++) {
        values.add((Serializable) s.readObject());
    }

    validateUntampered(numElements);

}