Java Code Examples for java.io.ObjectInput#readObject()
The following examples show how to use
java.io.ObjectInput#readObject() .
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 File: OHLCItemTests.java From astor with 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 2
Source File: IndexDescriptorImpl.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
/** * @see java.io.Externalizable#readExternal * * @exception IOException Thrown on read error */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { FormatableHashtable fh = (FormatableHashtable) in.readObject(); isUnique = fh.getBoolean("isUnique"); int bcpLength = fh.getInt("keyLength"); baseColumnPositions = new int[bcpLength]; isAscending = new boolean[bcpLength]; for (int i = 0; i < bcpLength; i++) { baseColumnPositions[i] = fh.getInt("bcp" + i); isAscending[i] = fh.getBoolean("isAsc" + i); } numberOfOrderedColumns = fh.getInt("orderedColumns"); indexType = (String) fh.get("indexType"); //isUniqueWithDuplicateNulls attribute won't be present if the index //was created in older versions isUniqueWithDuplicateNulls = fh.containsKey("isUniqueWithDuplicateNulls") && fh.getBoolean("isUniqueWithDuplicateNulls"); excludeNulls = fh.containsKey("excludeNulls") && fh.getBoolean("excludeNulls"); excludeDefaults = fh.containsKey("excludeDefaults") && fh.getBoolean("excludeDefaults"); }
Example 3
Source File: MultiProbeDerbyScanInformation.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); getProbeValsFuncName = SerializationUtils.readNullableString(in); sortRequired = in.readInt(); inlistPosition = in.readInt(); if (in.readBoolean()) { probeValues = new DataValueDescriptor[in.readInt()]; for (int i = 0; i < probeValues.length; i++) { probeValues[i] = (DataValueDescriptor) in.readObject(); } } probeValue = (DataValueDescriptor)in.readObject(); inlistTypeArrayItem = in.readInt(); }
Example 4
Source File: EmptyBlockTests.java From astor with 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 5
Source File: PieLabelRecordTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { PieLabelRecord p1 = new PieLabelRecord("A", 1.0, 2.0, new TextBox("B"), 3.0, 4.0, 5.0); PieLabelRecord p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); p2 = (PieLabelRecord) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } boolean b = p1.equals(p2); assertTrue(b); }
Example 6
Source File: ScanOperation.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException{ super.readExternal(in); oneRowScan=in.readBoolean(); lockMode=in.readInt(); isolationLevel=in.readInt(); scanInformation=(ScanInformation<ExecRow>)in.readObject(); tableVersion=in.readUTF(); rowIdKey = in.readBoolean(); pin = in.readBoolean(); delimited = in.readBoolean()?in.readUTF():null; escaped = in.readBoolean()?in.readUTF():null; lines = in.readBoolean()?in.readUTF():null; storedAs = in.readBoolean()?in.readUTF():null; location = in.readBoolean()?in.readUTF():null; partitionRefItem = in.readInt(); splits = in.readInt(); }
Example 7
Source File: XYCoordinateTests.java From astor with 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 8
Source File: OHLCSeriesTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { OHLCSeries s1 = new OHLCSeries("s1"); s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0); OHLCSeries s2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(s1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); s2 = (OHLCSeries) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(s1, s2); }
Example 9
Source File: BitArray.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Read the whole tree from a file (serialized) */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { _bitSize = in.readInt(); _intSize = (_bitSize >>> 5) + 1; _mask = in.readInt(); _bits = (int[])in.readObject(); }
Example 10
Source File: GenericQualifier.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { columnId = in.readInt(); storagePosition = in.readInt(); operator = in.readInt(); orderedNulls = in.readBoolean(); unknownRV = in.readBoolean(); negateCompareResult = in.readBoolean(); variantType = in.readInt(); orderableCache = (DataValueDescriptor) in.readObject(); }
Example 11
Source File: BasicProviderInfo.java From gemfirexd-oss with Apache License 2.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 { FormatableHashtable fh = (FormatableHashtable)in.readObject(); uuid = (UUID)fh.get("uuid"); dFinder = (DependableFinder)fh.get("dFinder"); providerName = (String) fh.get("providerName"); }
Example 12
Source File: AsyncSendNode.java From kogito-runtimes with Apache License 2.0 | 5 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal( in ); dataProvider = (DataProvider) in.readObject(); alphaConstraints = (AlphaNodeFieldConstraint[]) in.readObject(); betaConstraints = (BetaConstraints) in.readObject(); tupleMemoryEnabled = in.readBoolean(); send = (AsyncSend) in.readObject(); }
Example 13
Source File: ObjectFieldImpl.java From kogito-runtimes with Apache License 2.0 | 5 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { isEnum = in.readBoolean(); enumName = (String) in.readObject(); fieldName = (String) in.readObject(); if ( !isEnum || enumName == null || fieldName == null ) { value = (Serializable) in.readObject(); } else { resolveEnumValue( (DroolsObjectInputStream) in ); } setBooleans(); }
Example 14
Source File: HashTableIterator.java From kogito-runtimes with Apache License 2.0 | 5 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { hashTable = (AbstractHashTable) in.readObject(); table = (Entry[]) in.readObject(); row = in.readInt(); length = in.readInt(); entry = (Entry) in.readObject(); }
Example 15
Source File: SingleHopInformation.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
private void readRangeResolverData(ObjectInput in) throws ClassNotFoundException, IOException { this.rangeValuesHolderList = (ArrayList)in.readObject(); }
Example 16
Source File: CompositeLeftTupleSinkAdapter.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal( in ); this.sinks = (LeftTupleSinkNodeList) in.readObject(); }
Example 17
Source File: From.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { dataProvider = ( DataProvider ) in.readObject(); resultPattern = ( Pattern ) in.readObject(); resultClass = ( Class<?> ) in.readObject(); }
Example 18
Source File: PlatformSqlQueryTask.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { arg = (String)in.readObject(); }
Example 19
Source File: PullPushAdapter.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { identifier=(Serializable)in.readObject(); }
Example 20
Source File: LocalPartitionMetadata.java From database with GNU General Public License v2.0 | 2 votes |
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { final short version = ShortPacker.unpackShort(in); switch (version) { case VERSION0: case VERSION1: case VERSION2: break; default: throw new IOException("Unknown version: " + version); } if (version < VERSION2) { partitionId = (int) LongPacker.unpackLong(in); } else { partitionId = in.readInt(); } sourcePartitionId = in.readInt(); // MAY be -1. final int nresources = ShortPacker.unpackShort(in); final int leftLen = (int) LongPacker.unpackLong(in); final int rightLen = (int) LongPacker.unpackLong(in); leftSeparatorKey = new byte[leftLen]; in.readFully(leftSeparatorKey); if (rightLen != 0) { rightSeparatorKey = new byte[rightLen]; in.readFully(rightSeparatorKey); } else { rightSeparatorKey = null; } cause = (IndexPartitionCause)in.readObject(); if (version < VERSION2) { /* history = */in.readUTF(); } resources = nresources>0 ? new IResourceMetadata[nresources] : null; for (int j = 0; j < nresources; j++) { final boolean isIndexSegment = in.readBoolean(); final String filename = in.readUTF(); // long nbytes = LongPacker.unpackLong(in); final UUID uuid = new UUID(in.readLong()/*MSB*/,in.readLong()/*LSB*/); final long createTime = in.readLong(); long commitTime = 0L; if (version >= VERSION1 && !isIndexSegment) { commitTime = in.readLong(); } resources[j] = (isIndexSegment // ? new SegmentMetadata(filename, /*nbytes,*/ uuid, createTime) // : new JournalMetadata(filename, /*nbytes,*/ uuid, createTime, commitTime) // ); } }