java.io.ObjectInput Java Examples
The following examples show how to use
java.io.ObjectInput.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: blip Author: mauro-idsia File: TCustomHashMap.java License: GNU Lesser General Public License v3.0 | 6 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION byte version = in.readByte(); // NOTE: super was not written in version 0 if (version != 0) { super.readExternal(in); } // NUMBER OF ENTRIES int size = in.readInt(); setUp(size); // ENTRIES while (size-- > 0) { // noinspection unchecked K key = (K) in.readObject(); // noinspection unchecked V val = (V) in.readObject(); put(key, val); } }
Example #2
Source Project: astor Author: SpoonLabs File: FirstOrderIntegratorWithJacobians.java License: GNU General Public License v2.0 | 6 votes |
/** {@inheritDoc} */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { interpolator = (StepInterpolator) in.readObject(); final int n = in.readInt(); final int k = in.readInt(); y = new double[n]; dydy0 = new double[n][n]; dydp = new double[n][k]; yDot = new double[n]; dydy0Dot = new double[n][n]; dydpDot = new double[n][k]; readArray(in, y); readArray(in, dydy0); readArray(in, dydp); readArray(in, yDot); readArray(in, dydy0Dot); readArray(in, dydpDot); }
Example #3
Source Project: astor Author: SpoonLabs File: SimpleHistogramBinTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { SimpleHistogramBin b1 = new SimpleHistogramBin(1.0, 2.0, false, true); b1.setItemCount(123); SimpleHistogramBin b2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(b1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); b2 = (SimpleHistogramBin) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(b1, b2); }
Example #4
Source Project: openjdk-8 Author: bpupadhyaya File: ExternObjTrees.java License: GNU General Public License v2.0 | 6 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { z = in.readBoolean(); b = in.readByte(); c = in.readChar(); s = in.readShort(); i = in.readInt(); f = in.readFloat(); j = in.readLong(); d = in.readDouble(); str = (String) in.readObject(); parent = in.readObject(); left = in.readObject(); right = in.readObject(); }
Example #5
Source Project: astor Author: SpoonLabs File: OHLCItemTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { OHLCItem item1 = new OHLCItem(new Year(2006), 2.0, 4.0, 1.0, 3.0); OHLCItem item2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(item1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); item2 = (OHLCItem) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(item1, item2); }
Example #6
Source Project: yangtools Author: opendaylight File: NIPv2.java License: Eclipse Public License 1.0 | 6 votes |
@Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { final QName qname = QName.readFrom(in); final int size = in.readInt(); switch (size) { case 0: nip = NodeIdentifierWithPredicates.of(qname); break; case 1: nip = NodeIdentifierWithPredicates.of(qname, QName.readFrom(in), in.readObject()); break; default: final Builder<QName, Object> keys = ImmutableMap.builderWithExpectedSize(size); for (int i = 0; i < size; ++i) { keys.put(QName.readFrom(in), in.readObject()); } nip = NodeIdentifierWithPredicates.of(qname, keys.build()); } }
Example #7
Source Project: blip Author: mauro-idsia File: THash.java License: GNU Lesser General Public License v3.0 | 6 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // LOAD FACTOR float old_factor = _loadFactor; _loadFactor = Math.abs(in.readFloat()); // AUTO COMPACTION LOAD FACTOR _autoCompactionFactor = in.readFloat(); // If we change the laod factor from the default, re-setup if (old_factor != _loadFactor) { setUp( saturatedCast( (long) Math.ceil( DEFAULT_CAPACITY / (double) _loadFactor))); } }
Example #8
Source Project: astor Author: SpoonLabs File: OHLCTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { OHLC i1 = new OHLC(2.0, 4.0, 1.0, 3.0); OHLC i2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(i1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); i2 = (OHLC) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(i1, i2); }
Example #9
Source Project: astor Author: SpoonLabs File: YIntervalRendererTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { YIntervalRenderer r1 = new YIntervalRenderer(); YIntervalRenderer r2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(r1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); r2 = (YIntervalRenderer) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(r1, r2); }
Example #10
Source Project: ccu-historian Author: mdzio File: RectangleAnchorTest.java License: GNU General Public License v3.0 | 6 votes |
/** * Serialize an instance, restore it, and check for identity. */ public void testSerialization() { final RectangleAnchor a1 = RectangleAnchor.RIGHT; RectangleAnchor a2 = null; try { final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); final ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); final ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); a2 = (RectangleAnchor) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertTrue(a1 == a2); }
Example #11
Source Project: mrgeo Author: ngageoint File: DelimitedParser.java License: Apache License 2.0 | 6 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { boolean hasAttributes = in.readBoolean(); if (hasAttributes) { attributeNames = new ArrayList<>(); int count = in.readInt(); for (int i = 0; i < count; i++) { attributeNames.add(in.readUTF()); } } xCol = in.readInt(); yCol = in.readInt(); geometryCol = in.readInt(); delimiter = in.readChar(); encapsulator = in.readChar(); skipFirstLine = in.readBoolean(); }
Example #12
Source Project: gumtree-spoon-ast-diff Author: SpoonLabs File: right_IrmiPRODelegate_1.3.java License: Apache License 2.0 | 6 votes |
public void receive(byte code, ObjectInput in) throws IOException, ClassNotFoundException { JClientRequestInfo info = new JRMPClientRequestInfoImpl(); int len = in.readShort(); for (int i = 0; i < len; i++) { info.add_request_service_context((JServiceContext) in.readObject()); } for (int i = 0; i < cis.length; i++) { switch (code) { case METHOD_RESULT: cis[i].receive_reply(info); break; case METHOD_ERROR: case SYSTEM_ERROR: cis[i].receive_exception(info); break; } } }
Example #13
Source Project: astor Author: SpoonLabs File: XYCoordinateTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { XYCoordinate v1 = new XYCoordinate(1.0, 2.0); XYCoordinate v2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(v1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); v2 = (XYCoordinate) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(v1, v2); }
Example #14
Source Project: astor Author: SpoonLabs File: EmptyBlockTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { EmptyBlock b1 = new EmptyBlock(1.0, 2.0); EmptyBlock b2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(b1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); b2 = (EmptyBlock) in.readObject(); in.close(); } catch (Exception e) { fail(e.toString()); } assertEquals(b1, b2); }
Example #15
Source Project: astor Author: SpoonLabs File: SymbolicXYItemLabelGeneratorTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { SymbolicXYItemLabelGenerator g1 = new SymbolicXYItemLabelGenerator(); SymbolicXYItemLabelGenerator g2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(g1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); g2 = (SymbolicXYItemLabelGenerator) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(g1, g2); }
Example #16
Source Project: netbeans Author: apache File: ModuleData.java License: Apache License 2.0 | 6 votes |
ModuleData(ObjectInput dis) throws IOException { try { this.codeName = dis.readUTF(); this.codeNameBase = dis.readUTF(); this.codeNameRelease = dis.readInt(); this.coveredPackages = readStrings(dis, new HashSet<String>(), true); this.dependencies = (Dependency[]) dis.readObject(); this.implVersion = dis.readUTF(); this.buildVersion = dis.readUTF(); this.provides = readStrings(dis); this.friendNames = readStrings(dis, new HashSet<String>(), false); this.specVers = new SpecificationVersion(dis.readUTF()); this.publicPackages = Module.PackageExport.read(dis); this.agentClass = dis.readUTF(); String s = dis.readUTF(); if (s != null) { s = s.trim(); } this.fragmentHostCodeName = s == null || s.isEmpty() ? null : s; } catch (ClassNotFoundException cnfe) { throw new IOException(cnfe); } }
Example #17
Source Project: astor Author: SpoonLabs File: OHLCItemTests.java License: GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { OHLCItem item1 = new OHLCItem(new Year(2006), 2.0, 4.0, 1.0, 3.0); OHLCItem item2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(item1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); item2 = (OHLCItem) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(item1, item2); }
Example #18
Source Project: jdk8u-jdk Author: lambdalab-mirror File: UnicastServerRef.java License: GNU General Public License v2.0 | 6 votes |
/** * Sets a filter for invocation arguments, if a filter has been set. * Called by dispatch before the arguments are read. */ protected void unmarshalCustomCallData(ObjectInput in) throws IOException, ClassNotFoundException { if (filter != null && in instanceof ObjectInputStream) { // Set the filter on the stream ObjectInputStream ois = (ObjectInputStream) in; AccessController.doPrivileged(new PrivilegedAction<Void>() { @Override public Void run() { ObjectInputFilter.Config.setObjectInputFilter(ois, filter); return null; } }); } }
Example #19
Source Project: keycloak Author: keycloak File: RoleUpdatedEvent.java License: Apache License 2.0 | 5 votes |
@Override public RoleUpdatedEvent readObject(ObjectInput input) throws IOException, ClassNotFoundException { switch (input.readByte()) { case VERSION_1: return readObjectVersion1(input); default: throw new IOException("Unknown version"); } }
Example #20
Source Project: openjdk-jdk8u-backup Author: AdoptOpenJDK File: HijrahDate.java License: GNU General Public License v2.0 | 5 votes |
static HijrahDate readExternal(ObjectInput in) throws IOException, ClassNotFoundException { HijrahChronology chrono = (HijrahChronology) in.readObject(); int year = in.readInt(); int month = in.readByte(); int dayOfMonth = in.readByte(); return chrono.date(year, month, dayOfMonth); }
Example #21
Source Project: spliceengine Author: splicemachine File: AvgAggregator.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * @see java.io.Externalizable#readExternal * * @exception IOException on error */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { aggregator = (SumAggregator)in.readObject(); //TODO -sf- is this the most efficient? perhaps better to get the sum direct eliminatedNulls = in.readBoolean(); count = in.readLong(); scale = in.readInt(); }
Example #22
Source Project: jenetics Author: jenetics File: Serial.java License: Apache License 2.0 | 5 votes |
@Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { _type = in.readByte(); switch (_type) { case OBJECT_STORE: _object = ObjectStore.read(in); break; case ARRAY: _object = Array.read(in); break; case CHAR_STORE: _object = CharStore.read(in); break; default: throw new StreamCorruptedException("Unknown serialized type."); } }
Example #23
Source Project: spliceengine Author: splicemachine File: SQLBinary.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * delegated to bit * * @exception IOException io exception * @exception ClassNotFoundException class not found */ public final void readExternal(ObjectInput in) throws IOException { // need to clear stream first, in case this object is reused, and // stream is set by previous use. Track 3794. stream = null; streamValueLength = -1; _blobValue = null; if (in instanceof FormatIdInputStream) { } else { isNull = in.readBoolean(); if (isNull) { return; } } int len = SQLBinary.readBinaryLength(in); if (len != 0) { dataValue = new byte[len]; in.readFully(dataValue); } else { readFromStream((InputStream) in); } isNull = evaluateNull(); }
Example #24
Source Project: tomee Author: apache File: AuthenticationResponse.java License: Apache License 2.0 | 5 votes |
@Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { final byte version = in.readByte(); // future use responseCode = in.readByte(); switch (responseCode) { case ResponseCodes.AUTH_GRANTED: identity = new ClientMetaData(); identity.setMetaData(metaData); identity.readExternal(in); break; case ResponseCodes.AUTH_REDIRECT: identity = new ClientMetaData(); identity.setMetaData(metaData); identity.readExternal(in); server = new ServerMetaData(); server.setMetaData(metaData); server.readExternal(in); break; case ResponseCodes.AUTH_DENIED: final ThrowableArtifact ta = new ThrowableArtifact(); ta.setMetaData(metaData); ta.readExternal(in); deniedCause = ta.getThrowable(); break; } }
Example #25
Source Project: symja_android_library Author: axkr File: PatternMatcher.java License: GNU General Public License v3.0 | 5 votes |
@Override public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { fLhsPatternExpr = (IExpr) objectInput.readObject(); fPatternCondition = (IExpr) objectInput.readObject(); if (fLhsPatternExpr != null) { int[] priority = new int[] { IPatternMap.DEFAULT_RULE_PRIORITY }; this.fPatternMap = IPatternMap.determinePatterns(fLhsPatternExpr, priority); fLHSPriority = priority[0]; } }
Example #26
Source Project: desugar_jdk_libs Author: google File: ChronoZonedDateTimeImpl.java License: GNU General Public License v2.0 | 5 votes |
static ChronoZonedDateTime<?> readExternal(ObjectInput in) throws IOException, ClassNotFoundException { ChronoLocalDateTime<?> dateTime = (ChronoLocalDateTime<?>) in.readObject(); ZoneOffset offset = (ZoneOffset) in.readObject(); ZoneId zone = (ZoneId) in.readObject(); return dateTime.atZone(offset).withZoneSameLocal(zone); // TODO: ZDT uses ofLenient() }
Example #27
Source Project: astor Author: SpoonLabs File: DummyStepInterpolator.java License: GNU General Public License v2.0 | 5 votes |
/** Read the instance from an input channel. * @param in input channel * @exception IOException if the instance cannot be read */ @Override public void readExternal(final ObjectInput in) throws IOException { // read the base class final double t = readBaseExternal(in); // we can now set the interpolated time and state setInterpolatedTime(t); }
Example #28
Source Project: spliceengine Author: splicemachine File: RoutineAliasInfo.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * Read this object from a stream of stored objects. * * @param in read this. * * @exception IOException thrown on error * @exception ClassNotFoundException thrown on error */ public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException { super.readExternal(in); specificName = (String) in.readObject(); dynamicResultSets = in.readInt(); parameterCount = in.readInt(); parameterStyle = in.readShort(); sqlOptions = in.readShort(); returnType = getStoredType(in.readObject()); calledOnNullInput = in.readBoolean(); // expansionNum is used for adding more fields in the future. // It is an indicator for whether extra fields exist and need // to be written expansionNum = in.readInt(); if (parameterCount != 0) { parameterNames = new String[parameterCount]; parameterTypes = new TypeDescriptor[parameterCount]; ArrayUtil.readArrayItems(in, parameterNames); for (int p = 0; p < parameterTypes.length; p++) { parameterTypes[p] = getStoredType(in.readObject()); } parameterModes = ArrayUtil.readIntArray(in); } else { parameterNames = null; parameterTypes = null; parameterModes = null; } if(expansionNum == 1){ language = (String) in.readObject(); compiledPyCode = (byte[]) in.readObject(); } }
Example #29
Source Project: keycloak Author: keycloak File: PolicyUpdatedEvent.java License: Apache License 2.0 | 5 votes |
public PolicyUpdatedEvent readObjectVersion1(ObjectInput input) throws IOException, ClassNotFoundException { PolicyUpdatedEvent res = new PolicyUpdatedEvent(); res.id = MarshallUtil.unmarshallString(input); res.name = MarshallUtil.unmarshallString(input); res.resources = KeycloakMarshallUtil.readCollection(input, KeycloakMarshallUtil.STRING_EXT, HashSet::new); res.resourceTypes = KeycloakMarshallUtil.readCollection(input, KeycloakMarshallUtil.STRING_EXT, HashSet::new); res.scopes = KeycloakMarshallUtil.readCollection(input, KeycloakMarshallUtil.STRING_EXT, HashSet::new); res.serverId = MarshallUtil.unmarshallString(input); return res; }
Example #30
Source Project: spf Author: lil-lab File: JointModel.java License: GNU General Public License v2.0 | 5 votes |
/** * Read {@link JointModel} object from a file. */ public static <DI extends ISituatedDataItem<?, ?>, MR, ESTEP> JointModel<DI, MR, ESTEP> readJointModel( File file) throws ClassNotFoundException, IOException { LOG.info("Reading joint model from file..."); final long start = System.currentTimeMillis(); try (final ObjectInput input = new ObjectInputStream( new BufferedInputStream(new FileInputStream(file)))) { @SuppressWarnings("unchecked") final JointModel<DI, MR, ESTEP> model = (JointModel<DI, MR, ESTEP>) input .readObject(); LOG.info("Model loaded. Reading time: %.4f", (System.currentTimeMillis() - start) / 1000.0); return model; } }