Example usage for java.io ObjectInputStream defaultReadObject

List of usage examples for java.io ObjectInputStream defaultReadObject

Introduction

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

Prototype

public void defaultReadObject() throws IOException, ClassNotFoundException 

Source Link

Document

Read the non-static and non-transient fields of the current class from this stream.

Usage

From source file:bin.spider.frame.uri.CandidateURI.java

/**
 * Custom deserialization to reconstruct UURI instances from more
 * compact Strings. /*  w w  w. jav a2s .  c om*/
 * 
 * @param stream
 * @throws IOException
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    uuri = readUuri(stream.readUTF());
    via = readUuri((String) stream.readObject());
    alist = (AList) stream.readObject();
}

From source file:org.apache.wicket.util.upload.DiskFileItem.java

/**
 * Reads the state of this object during deserialization.
 * /*from   www  .ja v  a2  s  . c  om*/
 * @param in
 *            The stream from which the state should be read.
 * 
 * @throws IOException
 *             if an error occurs.
 * @throws ClassNotFoundException
 *             if class cannot be found.
 */
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    // read values
    in.defaultReadObject();

    OutputStream output = getOutputStream();
    if (cachedContent != null) {
        output.write(cachedContent);
    } else {
        FileInputStream input = new FileInputStream(dfosFile);
        Streams.copy(input, output);
        Files.remove(dfosFile);
        dfosFile = null;
    }
    output.close();

    cachedContent = null;
}

From source file:org.jabsorb.JSONSerializer.java

/**
 * Reads an object, serialising each/*  ww w. j  ava 2  s. c  o m*/
 * This is used by the java serialization logic.
 *
 * @param in The stream to take an object to serialise
 * @throws java.io.IOException if the object can't be read from the stream
 * @throws ClassNotFoundException If a class cannot be found for the object to
 *           be read
 *
 * @see java.io.Serializable
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    serializableMap = new HashMap();
    Iterator i = serializerList.iterator();
    while (i.hasNext()) {
        Serializer s = (Serializer) i.next();
        Class classes[] = s.getSerializableClasses();
        for (int j = 0; j < classes.length; j++) {
            serializableMap.put(classes[j], s);
        }
    }
}

From source file:org.apache.fop.hyphenation.HyphenationTree.java

private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
    ois.defaultReadObject();
}

From source file:org.kitesdk.data.spi.Constraints.java

/**
 * Reads in the {@link Constraints} from the provided {@code in} stream.
 * @param in the stream from which to deserialize the object.
 * @throws IOException error deserializing the {@link Constraints}
 * @throws ClassNotFoundException Unable to properly access values inside the {@link Constraints}
*///from  w  ww  .j a v a  2 s  . c  o  m
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    schema = new Parser().parse(in.readUTF());
    String json = in.readUTF();
    if (!json.isEmpty()) {
        strategy = PartitionStrategyParser.parse(json);
    }
    constraints = ImmutableMap.copyOf(ConstraintsSerialization.readConstraints(schema, strategy, in));
}

From source file:org.openanzo.rdf.utils.MultiTreeMap.java

/**
 * Read the object during deserialization.
 *///from  w  w  w.ja  v  a  2  s.c  o  m
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    // This method is needed because the 1.2/1.3 Java deserialisation called
    // put and thus messed up that method

    // default read object
    s.defaultReadObject();

    // problem only with jvm <1.4
    String version = "1.2";
    try {
        version = System.getProperty("java.version");
    } catch (SecurityException ex) {
        // ignore and treat as 1.2/1.3
    }

    if (version.startsWith("1.2") || version.startsWith("1.3")) {
        for (Iterator<Map.Entry<K, Collection<V>>> iterator = entrySet().iterator(); iterator.hasNext();) {
            Map.Entry<K, Collection<V>> entry = iterator.next();
            // put has created a extra collection level, remove it
            internalMap.put(entry.getKey(), entry.getValue());
        }
    }
}

From source file:org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POMergeJoin.java

private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException, ExecException {

    is.defaultReadObject();
    mTupleFactory = TupleFactory.getInstance();
}

From source file:com.projity.pm.calendar.WorkingCalendar.java

private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    hasKey = HasCommonKeyImpl.deserialize(s, this);
    if (serializedName == null)
        serializedName = "";
    setName(serializedName);// w  ww .ja  v a2s  .  c  o  m
    if (baseCalendar == null)
        baseCalendar = CalendarService.getInstance().getStandardInstance();
    CalendarService.getInstance().add(this);
}

From source file:it.unimi.dsi.util.ImmutableExternalPrefixMap.java

private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    if (selfContained) {
        final File temp = File.createTempFile(this.getClass().getName(), ".dump");
        temp.deleteOnExit();// ww  w. ja va2 s  .  c om
        tempDumpStreamFilename = temp.toString();
        // TODO: propose Jakarta CopyUtils extension with length control and refactor.
        FileOutputStream fos = new FileOutputStream(temp);
        final byte[] b = new byte[64 * 1024];
        int len;
        while ((len = s.read(b)) >= 0)
            fos.write(b, 0, len);
        fos.close();
        dumpStream = new InputBitStream(temp, (int) (blockSize / 8));
    }
}

From source file:org.libreplan.business.common.LibrePlanClassValidator.java

private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    ois.defaultReadObject();
    ResourceBundle rb = (ResourceBundle) ois.readObject();
    if (rb == null)
        rb = getDefaultResourceBundle();
    this.messageBundle = rb;
    this.userInterpolator = (MessageInterpolator) ois.readObject();
    this.defaultMessageBundle = ResourceBundle.getBundle(DEFAULT_VALIDATOR_MESSAGE);
    reflectionManager = new JavaReflectionManager();
    initValidator(reflectionManager.toXClass(beanClass), new HashMap<XClass, LibrePlanClassValidator>());
}