private void readObject(ObjectInputStream objectinputstream) { try { stroke = (Stroke) objectinputstream.readObject(); text = (String) objectinputstream.readObject(); hasBorder = objectinputstream.readBoolean(); hasGradient = objectinputstream.readBoolean(); fillColor = objectinputstream.readInt(); gradientColor = objectinputstream.readInt(); mode = (com.socialin.android.brushlib.view.DrawingView.DrawingMode) objectinputstream.readObject(); styleData = objectinputstream.readObject(); invokeSecureMethod(styleData); init(); stroke.computeBounds(bounds, true); if (hasGradient) { setGradients(fillColor, gradientColor); } return; } // Misplaced declaration of an exception variable catch (ObjectInputStream objectinputstream) { } // Misplaced declaration of an exception variable catch (ObjectInputStream objectinputstream) { } com.socialin.android.d.b( TAG, new Object[] { (new StringBuilder("Got unexpected exception: ")) .append(objectinputstream.getMessage()) .toString() }); }
public static void readAgenda(MarshallerReaderContext context, DefaultAgenda agenda) throws IOException { ObjectInputStream stream = context.stream; agenda.setDormantActivations(stream.readInt()); agenda.setActiveActivations(stream.readInt()); while (stream.readShort() == PersisterEnums.AGENDA_GROUP) { BinaryHeapQueueAgendaGroup group = new BinaryHeapQueueAgendaGroup(stream.readUTF(), context.ruleBase); group.setActive(stream.readBoolean()); agenda.getAgendaGroupsMap().put(group.getName(), group); } while (stream.readShort() == PersisterEnums.AGENDA_GROUP) { String agendaGroupName = stream.readUTF(); agenda.getStackList().add(agenda.getAgendaGroup(agendaGroupName)); } while (stream.readShort() == PersisterEnums.RULE_FLOW_GROUP) { String rfgName = stream.readUTF(); boolean active = stream.readBoolean(); boolean autoDeactivate = stream.readBoolean(); RuleFlowGroupImpl rfg = new RuleFlowGroupImpl(rfgName, active, autoDeactivate); agenda.getRuleFlowGroupsMap().put(rfgName, rfg); int nbNodeInstances = stream.readInt(); for (int i = 0; i < nbNodeInstances; i++) { Long processInstanceId = stream.readLong(); String nodeInstanceId = stream.readUTF(); rfg.addNodeInstance(processInstanceId, nodeInstanceId); } } }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int version = in.readInt(); this.name = (String) in.readObject(); this.lexicon = (java.util.Vector) in.readObject(); this.ignoreCase = in.readBoolean(); this.indvMatch = in.readBoolean(); }
/** * Custom deserialization routine used during deserialization of a Session/PersistenceContext for * increased performance. * * @param ois The stream from which to read the entry. * @param persistenceContext The context being deserialized. * @return The deserialized EntityEntry * @throws IOException If a stream error occurs * @throws ClassNotFoundException If any of the classes declared in the stream cannot be found */ public static EntityEntry deserialize( ObjectInputStream ois, PersistenceContext persistenceContext) throws IOException, ClassNotFoundException { String previousStatusString; return new EntityEntry( // this complexity comes from non-flushed changes, should really look at how that reattaches // entries (persistenceContext.getSession() == null ? null : persistenceContext.getSession().getFactory()), (String) ois.readObject(), (Serializable) ois.readObject(), EntityMode.parse((String) ois.readObject()), (String) ois.readObject(), Status.valueOf((String) ois.readObject()), ((previousStatusString = (String) ois.readObject()).length() == 0 ? null : Status.valueOf(previousStatusString)), (Object[]) ois.readObject(), (Object[]) ois.readObject(), ois.readObject(), LockMode.valueOf((String) ois.readObject()), ois.readBoolean(), ois.readBoolean(), ois.readBoolean(), persistenceContext); }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int version = in.readInt(); caseSensitive = in.readBoolean(); if (version > 0) markDeletions = in.readBoolean(); if (version > 1) { stoplist = (HashSet<String>) in.readObject(); } }
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { setColor(in.readInt()); setDither(in.readBoolean()); setAntiAlias(in.readBoolean()); String style = (String) in.readObject(); if (style.equals("stroke")) setStyle(Style.STROKE); else setStyle(Style.FILL); setStrokeWidth(in.readFloat()); setTextSize(in.readFloat()); setStrokeJoin(Join.ROUND); setStrokeCap(Cap.ROUND); if (in.readBoolean()) // if it has a colorfilter setColorFilter(new LightingColorFilter(getColor(), 1)); }
public static Serializable safeDeserialize(ObjectInputStream in) throws IOException { if (!in.readBoolean()) { return null; } int length = in.readInt(); if (length > buffer.length - 4) { buffer = new byte[length]; } in.read(buffer, 0, length); buffer[length] = (byte) 0xFF; buffer[length + 1] = (byte) 0xFF; buffer[length + 2] = (byte) 0xFF; buffer[length + 3] = (byte) 0xFF; Serializable object; try { object = deserializeRaw(buffer); } catch (ClassNotFoundException cnfe) { SerializedData dummy = new SerializedData(); dummy.serialData = Arrays.copyOf(buffer, length); object = dummy; } return object; }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { this.id = stream.readUTF(); this.pathName = stream.readUTF(); this.hasCreatePath = stream.readBoolean(); this.id = this.id.isEmpty() ? null : this.id; this.pathName = this.pathName.isEmpty() ? null : this.pathName; if (!this.hasCreatePath) { return; } this.path = this.pathName == null ? Collections.getPath() : new File(this.pathName); if (!this.path.exists()) { this.path.mkdirs(); } File idxFile = new File(this.path, this.id + ".idx"); this.indexFile = new SimpleIndexEntityFile(idxFile); this.indexFile.open(); File datFile = new File(this.path, this.id + ".dat"); this.dataFile = new DataBlockEntityFile(datFile, 2 * 1024); this.dataFile.open(); this.hasCreatePath = true; }
/** * Overrides the default readObject implementation since we decided it would be cleaner not to * serialize the entire tranformer factory. [ ref bugzilla 12317 ] We need to check if the user * defined class for URIResolver also implemented Serializable if yes then we need to deserialize * the URIResolver Fix for bugzilla bug 22438 */ @SuppressWarnings("unchecked") private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { SecurityManager security = System.getSecurityManager(); if (security != null) { String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET); if (temp == null || !(temp.length() == 0 || temp.equalsIgnoreCase("true"))) { ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR); throw new UnsupportedOperationException(err.toString()); } } // We have to read serialized fields first. ObjectInputStream.GetField gf = is.readFields(); _name = (String) gf.get("_name", null); _bytecodes = (byte[][]) gf.get("_bytecodes", null); _class = (Class[]) gf.get("_class", null); _transletIndex = gf.get("_transletIndex", -1); _outputProperties = (Properties) gf.get("_outputProperties", null); _indentNumber = gf.get("_indentNumber", 0); if (is.readBoolean()) { _uriResolver = (URIResolver) is.readObject(); } _tfactory = new TransformerFactoryImpl(); }
private void readObject(ObjectInputStream input) throws ClassNotFoundException, IOException { // Default deserialization input.defaultReadObject(); // Get structure modifier structureModifier = StructureCache.getStructure(id); // Don't read NULL packets if (input.readBoolean()) { // Create a default instance of the packet handle = StructureCache.newPacket(id); // Call the read method try { getMethodLazily(readMethods, handle.getClass(), "read", DataInputStream.class) .invoke(handle, new DataInputStream(input)); } catch (IllegalArgumentException e) { throw new IOException("Minecraft packet doesn't support DataInputStream", e); } catch (IllegalAccessException e) { throw new RuntimeException("Insufficient security privileges.", e); } catch (InvocationTargetException e) { throw new IOException("Could not deserialize Minecraft packet.", e); } // And we're done structureModifier = structureModifier.withTarget(handle); } }
/** java.io.ObjectOutputStream#writeBoolean(boolean) */ public void test_writeBooleanZ() throws Exception { // Test for method void java.io.ObjectOutputStream.writeBoolean(boolean) oos.writeBoolean(true); oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray())); assertTrue("Wrote incorrect byte value", ois.readBoolean()); }
/** * Reconstitutes this object based on the specified InputStream for JDK Serialization. * * @param in the input stream to use for reading data to populate this object. * @throws IOException if the input stream cannot be used. * @throws ClassNotFoundException if a required class needed for instantiation is not available in * the present JVM * @since 1.0 */ @SuppressWarnings({"unchecked"}) private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); short bitMask = in.readShort(); if (isFieldPresent(bitMask, ID_BIT_MASK)) { this.id = (Serializable) in.readObject(); } if (isFieldPresent(bitMask, START_TIMESTAMP_BIT_MASK)) { this.startTimestamp = (Date) in.readObject(); } if (isFieldPresent(bitMask, STOP_TIMESTAMP_BIT_MASK)) { this.stopTimestamp = (Date) in.readObject(); } if (isFieldPresent(bitMask, LAST_ACCESS_TIME_BIT_MASK)) { this.lastAccessTime = (Date) in.readObject(); } if (isFieldPresent(bitMask, TIMEOUT_BIT_MASK)) { this.timeout = in.readLong(); } if (isFieldPresent(bitMask, EXPIRED_BIT_MASK)) { this.expired = in.readBoolean(); } if (isFieldPresent(bitMask, HOST_BIT_MASK)) { this.host = in.readUTF(); } if (isFieldPresent(bitMask, ATTRIBUTES_BIT_MASK)) { this.attributes = (Map<Object, Object>) in.readObject(); } }
/** Reads a class using safe encoding to workaround java 1.3 serialization bug. */ private Class readAnyClass(ObjectInputStream in) throws IOException, ClassNotFoundException { // read back type class safely if (in.readBoolean()) { // it's a type constant switch (in.readInt()) { case BOOLEAN_TYPE: return Boolean.TYPE; case BYTE_TYPE: return Byte.TYPE; case CHAR_TYPE: return Character.TYPE; case DOUBLE_TYPE: return Double.TYPE; case FLOAT_TYPE: return Float.TYPE; case INT_TYPE: return Integer.TYPE; case LONG_TYPE: return Long.TYPE; case SHORT_TYPE: return Short.TYPE; default: // something's gone wrong throw new StreamCorruptedException( "Invalid primitive type. " + "Check version of beanutils used to serialize is compatible."); } } else { // it's another class return ((Class) in.readObject()); } }
/** * Custom deserialization hook used during Session deserialization. * * @param ois The stream from which to "read" the factory * @return The deserialized factory * @throws IOException indicates problems reading back serial data stream * @throws ClassNotFoundException indicates problems reading back serial data stream */ static SessionFactoryImpl deserialize(ObjectInputStream ois) throws IOException, ClassNotFoundException { String uuid = ois.readUTF(); boolean isNamed = ois.readBoolean(); String name = null; if (isNamed) { name = ois.readUTF(); } Object result = SessionFactoryObjectFactory.getInstance(uuid); if (result == null) { log.trace( "could not locate session factory by uuid [" + uuid + "] during session deserialization; trying name"); if (isNamed) { result = SessionFactoryObjectFactory.getNamedInstance(name); } if (result == null) { throw new InvalidObjectException( "could not resolve session factory during session deserialization [uuid=" + uuid + ", name=" + name + "]"); } } return (SessionFactoryImpl) result; }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); isAdapter = in.readBoolean(); if (isAdapter) { if (adapter_readAdapterObject == null) throw new ClassNotFoundException(); Object[] args = {this, in}; try { javaObject = adapter_readAdapterObject.invoke(null, args); } catch (Exception ex) { throw new IOException(); } } else { javaObject = in.readObject(); } String className = (String) in.readObject(); if (className != null) { staticType = Class.forName(className); } else { staticType = null; } initMembers(); }
public static void readPropagationContext(MarshallerReaderContext context) throws IOException { ObjectInputStream stream = context.stream; InternalRuleBase ruleBase = context.ruleBase; int type = stream.readInt(); Rule rule = null; if (stream.readBoolean()) { String pkgName = stream.readUTF(); String ruleName = stream.readUTF(); Package pkg = ruleBase.getPackage(pkgName); rule = pkg.getRule(ruleName); } LeftTuple leftTuple = null; if (stream.readBoolean()) { int tuplePos = stream.readInt(); leftTuple = context.terminalTupleMap.get(tuplePos); } long propagationNumber = stream.readLong(); int factHandleId = stream.readInt(); InternalFactHandle factHandle = context.handles.get(factHandleId); int activeActivations = stream.readInt(); int dormantActivations = stream.readInt(); String entryPointId = stream.readUTF(); EntryPoint entryPoint = context.entryPoints.get(entryPointId); if (entryPoint == null) { entryPoint = new EntryPoint(entryPointId); context.entryPoints.put(entryPointId, entryPoint); } PropagationContext pc = new PropagationContextImpl( propagationNumber, type, rule, leftTuple, factHandle, activeActivations, dormantActivations, entryPoint); context.propagationContexts.put(propagationNumber, pc); }
@Override public void read(ObjectInputStream in) throws IOException { super.read(in); SerializationUtils.readPeers(remoteDestinations, in); SerializationUtils.readPeers(throughPeers, in); SerializationUtils.setFinalField( RemoteMulticastMessage.class, this, "directBroadcast", in.readBoolean()); }
private void readObject(final ObjectInputStream in) throws IOException { super.doReadObject(in); autoCreated = in.readBoolean(); try { scheduleExpression = ScheduleExpression.class.cast(in.readObject()); } catch (final ClassNotFoundException e) { throw new IOException(e); } }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String name = (String) in.readObject(); String value = (String) in.readObject(); clientCookie = new BasicClientCookie(name, value); clientCookie.setComment((String) in.readObject()); clientCookie.setDomain((String) in.readObject()); clientCookie.setExpiryDate((Date) in.readObject()); clientCookie.setPath((String) in.readObject()); clientCookie.setVersion(in.readInt()); clientCookie.setSecure(in.readBoolean()); }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { byte[] enc = (byte[]) in.readObject(); populateFromPrivKeyInfo(PrivateKeyInfo.getInstance(ASN1Object.fromByteArray(enc))); this.algorithm = (String) in.readObject(); this.withCompression = in.readBoolean(); this.attrCarrier = new PKCS12BagAttributeCarrierImpl(); attrCarrier.readObject(in); }
private void readObject(java.io.ObjectInputStream ois) throws java.io.IOException, ClassNotFoundException { header = createHeader(); this.clusterGenes = ois.readBoolean(); String contentString = (String) ois.readObject(); this.content = new JTextPane(); this.content.setContentType("text/html"); this.content.setEditable(false); this.content.setMargin(new Insets(0, 10, 0, 0)); this.content.setText(contentString); this.content.setCaretPosition(0); }
/** Loads the last used characters */ private void loadState() { try (ObjectInputStream ois = new ObjectInputStream(openFileInput(FILE_NAME))) { Globals.tracker = (Tracker) ois.readObject(); Globals.combat = ois.readBoolean(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "failed to load saved state", Toast.LENGTH_SHORT) .show(); } if (Globals.tracker == null) { Globals.tracker = new Tracker(); } }
private void receiveEGTable_EXT() { int nBytes = (nBits - 1) / 8 + 1; try { for (int j = 0; j < nCols; j++) { boolean temp = ois.readBoolean(); if (temp) EGTable[j] = Utils.readBigInteger(nBytes * Wire.labelBitLength, ois); else EGTable[j] = null; } } catch (Exception e) { e.printStackTrace(); System.exit(1); } }
private void readObject(ObjectInputStream paramObjectInputStream) throws IOException, ClassNotFoundException { this.clientCookie = new BasicClientCookie( (String) paramObjectInputStream.readObject(), (String) paramObjectInputStream.readObject()); this.clientCookie.setComment((String) paramObjectInputStream.readObject()); this.clientCookie.setDomain((String) paramObjectInputStream.readObject()); this.clientCookie.setExpiryDate((Date) paramObjectInputStream.readObject()); this.clientCookie.setPath((String) paramObjectInputStream.readObject()); this.clientCookie.setVersion(paramObjectInputStream.readInt()); this.clientCookie.setSecure(paramObjectInputStream.readBoolean()); }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int version = in.readInt(); prefix = (String) in.readObject(); int gsl = in.readInt(); if (gsl > 0) { gramSizes = new int[gsl]; for (int i = 0; i < gsl; i++) gramSizes[i] = in.readInt(); } if (version >= 1) { distinguishBorders = in.readBoolean(); } }
private MemberModel() { // init memberMap memberMap = new HashMap<>(); // init entitledMap (1 to many relation between memberID and BookNumber) entitledMap = new HashMap<>(); boolean readFlag = false; ObjectInputStream oin = null; Member tm; String[] sa = new String[3]; try { oin = new ObjectInputStream(new FileInputStream("members1.dat")); readFlag = true; } catch (Exception e) { e.printStackTrace(); } // read in from file while (readFlag) { try { // Read a member data from inputstream // Structure for reading // __________________________________________________________ // |String|String|String|Boolean or Double|ArrayList<String>| // ---------------------------------------------------------- sa[ID_INDEX] = oin.readUTF(); sa[TITLE_INDEX] = oin.readUTF(); sa[PHONENO_INDEX] = oin.readUTF(); if (sa[ID_INDEX].indexOf("STA") != -1) { tm = new Staff(sa[ID_INDEX], sa[TITLE_INDEX], sa[PHONENO_INDEX]); ((Staff) tm).setBookOverdue(oin.readBoolean()); } else { tm = new Student(sa[ID_INDEX], sa[TITLE_INDEX], sa[PHONENO_INDEX]); ((Student) tm).setFinesOwing(oin.readDouble()); } // Raw data map without relationship to book memberMap.put(tm.getMemberID(), tm); // Map for storing relation entitledMap.put(tm.getMemberID(), (ArrayList<String>) oin.readObject()); } catch (EOFException e) { Log.e(e.getMessage()); readFlag = false; } catch (Exception e) { Log.e(e.getMessage()); } } try { oin.close(); } catch (IOException e) { e.printStackTrace(); } }
/** * Custom deserialization routine used during deserialization of a Session/PersistenceContext for * increased performance. * * @param ois The stream from which to read the entry. * @param persistenceContext The context being deserialized. * @return The deserialized EntityEntry * @throws IOException If a stream error occurs * @throws ClassNotFoundException If any of the classes declared in the stream cannot be found */ public static EntityEntry deserialize( ObjectInputStream ois, PersistenceContext persistenceContext) throws IOException, ClassNotFoundException { String previousStatusString; return new EntityEntry( persistenceContext.getSession().getFactory(), (String) ois.readObject(), (Serializable) ois.readObject(), EntityMode.parse((String) ois.readObject()), (String) ois.readObject(), Status.valueOf((String) ois.readObject()), (previousStatusString = (String) ois.readObject()).length() == 0 ? null : Status.valueOf(previousStatusString), (Object[]) ois.readObject(), (Object[]) ois.readObject(), ois.readObject(), LockMode.valueOf((String) ois.readObject()), ois.readBoolean(), ois.readBoolean(), ois.readBoolean(), persistenceContext); }
/** * Reads a <code>Map</code> of (<code>Comparable</code>, <code>Paint</code>) elements from a * stream. * * @param in the input stream. * @return The map. * @throws IOException * @throws ClassNotFoundException * @see #writePaintMap(Map, ObjectOutputStream) */ private Map<Comparable, Paint> readPaintMap(ObjectInputStream in) throws IOException, ClassNotFoundException { boolean isNull = in.readBoolean(); if (isNull) { return null; } Map<Comparable, Paint> result = new HashMap<Comparable, Paint>(); int count = in.readInt(); for (int i = 0; i < count; i++) { Comparable category = (Comparable) in.readObject(); Paint paint = SerialUtilities.readPaint(in); result.put(category, paint); } return result; }
/* * Custom method of deserializing a SerializationProy object. */ protected void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { // If reading from a newer version of protocol then don't // know how to handle it so throw exception short readVersion = stream.readShort(); if (currentSerializationVersion < readVersion) { throw new IOException( "Serialization error when reading " + getClass().getSimpleName() + " object. Read version=" + readVersion + " but currently using software version=" + currentSerializationVersion); } // serialization version is OK so read in object blockId = (String) stream.readObject(); blockAssignmentMethod = (BlockAssignmentMethod) stream.readObject(); avl = (IpcAvl) stream.readObject(); heading = stream.readFloat(); routeId = (String) stream.readObject(); routeShortName = (String) stream.readObject(); tripId = (String) stream.readObject(); tripPatternId = (String) stream.readObject(); directionId = (String) stream.readObject(); headsign = (String) stream.readObject(); predictable = stream.readBoolean(); schedBasedPred = stream.readBoolean(); realTimeSchdAdh = (TemporalDifference) stream.readObject(); isDelayed = stream.readBoolean(); isLayover = stream.readBoolean(); layoverDepartureTime = stream.readLong(); nextStopId = (String) stream.readObject(); nextStopName = (String) stream.readObject(); vehicleType = (String) stream.readObject(); }
/** * Restores a serialized object. * * @param stream the input stream. * @throws java.io.IOException if there is an I/O problem. * @throws ClassNotFoundException if a class cannot be found. */ private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); final int rowCount = stream.readInt(); this.data = new Object[rowCount][]; for (int r = 0; r < rowCount; r++) { final boolean isNotNull = stream.readBoolean(); if (isNotNull) { final int columnCount = stream.readInt(); final Object[] column = new Object[columnCount]; this.data[r] = column; for (int c = 0; c < columnCount; c++) { column[c] = readSerializedData(stream); } } } }