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:LongArrayList.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();/*  w w w  .j av a 2  s  .  co  m*/
    array = new long[in.readInt()];
    for (int i = 0; i < size; i++) {
        array[i] = in.readLong();
    }
}

From source file:ShortArrayList.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();/*from  ww  w .  ja v a2  s.c om*/
    array = new short[in.readInt()];
    for (int i = 0; i < size; i++) {
        array[i] = in.readShort();
    }
}

From source file:FloatArrayList.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();//ww  w  . ja  va  2s  .  co  m
    array = new float[in.readInt()];
    for (int i = 0; i < size; i++) {
        array[i] = in.readFloat();
    }
}

From source file:DoubleArrayList.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();//ww  w. j a v a2  s . c om
    array = new double[in.readInt()];
    for (int i = 0; i < size; i++) {
        array[i] = in.readDouble();
    }
}

From source file:BooleanArrayList.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();/* ww w .j  a v a2s. c  o  m*/
    array = new boolean[in.readInt()];
    for (int i = 0; i < size; i++) {
        array[i] = in.readBoolean();
    }
}

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

@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException, EncryptorException {
    long version = in.readLong();

    if (version != serialVersionUID) {
        throw new SerializationException("Version expected '" + serialVersionUID + "' but got '" + version);
    }/*  w  w  w  . j  ava  2  s . c  om*/

    byte[] encrypted = new byte[in.readInt()];

    in.read(encrypted);

    value = (T) SerializationUtils.deserialize(getEncryptor().decrypt(encrypted));
}

From source file:com.ojcoleman.ahni.util.DoubleVector.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();/*w  ww. jav  a2 s.co  m*/
    _data = new double[in.readInt()];
    for (int i = 0; i < _size; i++) {
        _data[i] = in.readDouble();
    }
}

From source file:org.largecollections.FastCacheMap.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.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:net.sf.nmedit.jtheme.store2.AbstractMultiParameterElement.java

private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();//from  w w  w.ja va2 s. c  o m

    int size = in.readInt();

    parameterElementNames = new String[size];
    componentIdList = new String[size];

    size = in.readInt();
    for (int i = 0; i < size; i++) {
        int index = in.readInt();
        String n = (String) in.readObject();
        parameterElementNames[index] = n;
    }

    size = in.readInt();
    for (int i = 0; i < size; i++) {
        int index = in.readInt();
        String n = (String) in.readObject();
        componentIdList[index] = n;
    }

    size = in.readInt();
    if (size > 0) {
        valueList = new Object[size * 2];
        for (int i = 0; i < size; i += 2) {
            String name = (String) in.readObject();
            int value = in.readInt();
            valueList[i] = name;
            valueList[i + 1] = value;
        }
    }

}

From source file:com.izforge.izpack.installer.multiunpacker.MultiVolumeUnpacker.java

/**
 * Invoked prior to unpacking.//www  .ja v a  2s  .co  m
 * <p/>
 * This notifies the {@link ProgressListener}, and any registered {@link InstallerListener listeners}.
 *
 * @param packs the packs to unpack
 * @throws IzPackException for any error
 */
@Override
protected void preUnpack(List<Pack> packs) {
    super.preUnpack(packs);

    InputStream in = null;
    ObjectInputStream objectIn = null;
    try {
        // get volume metadata
        in = getResources().getInputStream(VOLUMES_INFO);
        objectIn = new ObjectInputStream(in);
        int volumeCount = objectIn.readInt();
        String volumeName = objectIn.readUTF();
        logger.fine("Reading from " + volumeCount + " volumes with basename " + volumeName + " ");

        String mediaPath = getInstallData().getMediaPath();
        if ((mediaPath == null) || (mediaPath.length() == 0)) {
            mediaPath = getDefaultMediaPath();
        }
        logger.fine("Using mediaDirectory = " + mediaPath);
        File volume = new File(mediaPath, volumeName);
        if (!volume.exists()) {
            volume = locator.getVolume(volume.getAbsolutePath(), false);
        }
        volumes = new FileSpanningInputStream(volume, volumeCount);
        volumes.setLocator(locator);
    } catch (IOException exception) {
        throw new InstallerException(exception);
    } finally {
        IOUtils.closeQuietly(in);
        IOUtils.closeQuietly(objectIn);
    }
}