List of usage examples for java.io ObjectInputStream defaultReadObject
public void defaultReadObject() throws IOException, ClassNotFoundException
From source file:org.nuxeo.ecm.core.api.SerializableInputStream.java
private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { // always perform the default de-serialization first in.defaultReadObject(); // create a temp file where we will put the blob content file = Framework.createTempFile("SerializableIS-", ".tmp"); Framework.trackFile(file, file);// w ww .j a va 2 s . co m OutputStream out = null; try { out = new FileOutputStream(file); byte[] buffer = new byte[IN_MEM_LIMIT]; int read; int bytes = in.readInt(); while (bytes > -1 && (read = in.read(buffer, 0, bytes)) != -1) { out.write(buffer, 0, read); bytes -= read; if (bytes == 0) { bytes = in.readInt(); } } } finally { if (out != null) { out.close(); } if (file.isFile()) { this.in = new BufferedInputStream(new FileInputStream(file)); } } }
From source file:net.sf.fspdfs.chartthemes.simple.LegendSettings.java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2) { positionValue = EdgeEnum.getByValue(position); position = null;/* w w w .ja va 2 s. c om*/ } }
From source file:org.mule.session.DefaultMuleSession.java
@SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); properties = (Map<String, Object>) in.readObject(); }
From source file:com.ocean.common.asserts.ConcurrencyThrottleSupport.java
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Rely on default serialization, just initialize state after // deserialization. ois.defaultReadObject(); // Initialize transient fields. this.logger = LogFactory.getLog(getClass()); this.monitor = new Object(); }
From source file:net.lightbody.bmp.proxy.jetty.util.Container.java
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); for (int c = 0; c < LazyList.size(_components); c++) { Object o = LazyList.get(_components, c); ComponentEvent event = new ComponentEvent(this, o); for (int i = 0; i < LazyList.size(_eventListeners); i++) { EventListener listener = (EventListener) LazyList.get(_eventListeners, i); if (listener instanceof ComponentListener) ((ComponentListener) listener).addComponent(event); }//from ww w . j av a2 s . com } }
From source file:WeakReferenceList.java
/** * Serialisation support. The transient child elements were not saved. * * @param in the input stream./* w w w .j a v a 2 s. c o m*/ * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if a serialized class is not defined on this system. */ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); childs = new Reference[getMaxChildCount() - 1]; for (int i = 0; i < childs.length; i++) { childs[i] = createReference(null); } }
From source file:com.phoenixst.plexus.util.SynchronizedGraph.java
private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { in.defaultReadObject(); if (delegate == null) { throw new InvalidObjectException("Wrapped Graph is null."); }// ww w . jav a2 s. c om if (mutex == null) { throw new InvalidObjectException("Mutex is null."); } initialize(); }
From source file:org.evosuite.utils.generic.GenericField.java
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); // Read/initialize additional fields Class<?> methodClass = TestGenerationContext.getInstance().getClassLoaderForSUT() .loadClass((String) ois.readObject()); String fieldName = (String) ois.readObject(); try {/*from w w w .j ava 2s .co m*/ field = methodClass.getDeclaredField(fieldName); field.setAccessible(true); } catch (SecurityException e) { throw new IllegalStateException( "Unknown field for " + fieldName + " in class " + methodClass.getCanonicalName()); } catch (NoSuchFieldException e) { throw new IllegalStateException( "Unknown field for " + fieldName + " in class " + methodClass.getCanonicalName()); } }
From source file:it.unimi.di.big.mg4j.index.BitStreamIndex.java
private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); readerConstructor = getConstructor(); }
From source file:edu.cmu.tetrad.util.ApacheTetradMatrix.java
/** * Adds semantic checks to the default deserialization method. This method * must have the standard signature for a readObject method, and the body of * the method must begin with "s.defaultReadObject();". Other than that, any * semantic checks can be specified and do not need to stay the same from * version to version. A readObject method of this form may be added to any * class, even if Tetrad sessions were previously saved out using a version * of the class that didn't include it. (That's what the * "s.defaultReadObject();" is for. See J. Bloch, Effective Java, for help. * * @throws java.io.IOException// w w w . ja v a 2 s . c om * @throws ClassNotFoundException */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); if (this.data != null) { double[][] d = data.toArray(); if (d.length == 0) { this.apacheData = new Array2DRowRealMatrix(); } else { this.apacheData = new BlockRealMatrix(d); } this.data = null; } }