/**
  * 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;
 }
  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);
      }
    }
  }
Example #3
0
  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;
  }
 private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
   label = in.readUTF();
   String uriStr = in.readUTF();
   uri = uriStr.equals("null") ? null : Uri.parse(uriStr);
   thumb =
       BitmapFactory.decodeFile(
           HistoryItemDao.ctx.getFileStreamPath(getThumbFilename()).getPath());
 }
Example #5
0
 public static NodeType read(ObjectInputStream ois) throws IOException {
   String namespace = ois.readUTF();
   String entityTypeName = ois.readUTF();
   String nodeName = ois.readUTF();
   return EnvironmentAccessor.get()
       .getDefinitions(namespace)
       .getEntityTypeMatchingInterface(entityTypeName, true)
       .getNodeType(nodeName, true);
 }
  public static void main(String[] args) throws IOException, ClassNotFoundException {

    FileOutputStream fout = null;
    ObjectOutputStream out = null;

    FileInputStream fin = null;
    ObjectInputStream in = null;

    SerializeClass obj = null;
    SerializeClass s = null;

    // Serialization for is-a relationship Starts
    obj = new SerializeClass(1, "Dushyant");

    // Serialization
    fout = new FileOutputStream("file.txt");
    out = new ObjectOutputStream(fout);

    out.writeObject(obj);
    out.flush();
    fout.close();
    out.close();

    // De-Serialization
    fin = new FileInputStream("file.txt");
    in = new ObjectInputStream(fin);
    s = (SerializeClass) in.readObject();
    System.out.println(s.getId() + " " + s.getName());

    fin.close();
    in.close();

    // Serialization for is-a relationship Ends

    // Serialization for has-a relationship Starts
    obj = new SerializeClass(1, "Dushyant");
    obj.setCityAndState(new CityState("Gurgaon", "Haryana"));
    fout = new FileOutputStream("file.txt");
    out = new ObjectOutputStream(fout);
    out.writeUTF(obj.getName()); // 1
    out.writeUTF(obj.getCityAndState().getCityName()); // 1
    out.writeUTF(obj.getCityAndState().getStateName()); // 1
    out.flush();
    out.close();

    fin = new FileInputStream("file.txt");
    in = new ObjectInputStream(fin);
    s = new SerializeClass();
    s.setCityAndState(new CityState());
    s.setName(in.readUTF()); // 2
    s.getCityAndState().setCityName(in.readUTF()); // 2
    s.getCityAndState().setStateName(in.readUTF()); // 2

    System.out.println(s);
    // Serialization for has-a relationship Ends
  }
Example #7
0
 private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
   m_title = in.readUTF();
   m_imageLink = in.readUTF();
   m_imageName = in.readUTF();
   m_urlTrimmed = in.readUTF();
   m_url = in.readUTF();
   m_content = in.readUTF();
   m_desLines = (String[]) in.readObject();
   m_time = in.readLong();
 }
 private static Map a_(ObjectInputStream objectInputStream) {
   Map emptyMap;
   int readInt = objectInputStream.readInt();
   emptyMap = readInt == 0 ? Collections.emptyMap() : new HashMap(readInt);
   int i = 0;
   while (i < readInt) {
     emptyMap.put(objectInputStream.readUTF().intern(), objectInputStream.readUTF().intern());
     i++;
   }
   return emptyMap;
 }
Example #9
0
  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();
    }
  }
Example #10
0
 /*  42:    */
 /*  43:    */ private void readObject(ObjectInputStream in)
     /*  44:    */ throws IOException, ClassNotFoundException
       /*  45:    */ {
   /*  46: 92 */ this.javaClass = getClassObject(in.readUTF());
   /*  47: 93 */ this.constructors = this.javaClass.getConstructors();
   /*  48: 94 */ this.methods = null;
   /*  49:    */ }
  // @include
  public static String findStudentWithTopThreeAverageScores(InputStream ifs) {
    Map<String, TreeSet<UniqueInteger>> studentScores = new HashMap<>();
    try {
      long sequence = 0;
      ObjectInputStream ois = new ObjectInputStream(ifs);
      while (true) {
        String name = ois.readUTF();
        int score = ois.readInt();
        TreeSet<UniqueInteger> scores = studentScores.get(name);
        if (scores == null) {
          scores = new TreeSet<>();
        }
        scores.add(new UniqueInteger(score, sequence++));
        studentScores.put(name, scores);
      }
    } catch (IOException e) {
    }

    String topStudent = "no such student";
    int currentTopThreeScoresSum = 0;
    for (Map.Entry<String, TreeSet<UniqueInteger>> scores : studentScores.entrySet()) {
      if (scores.getValue().size() >= 3) {
        int currentScoresSum = getTopThreeScoresSum(scores.getValue());
        if (currentScoresSum > currentTopThreeScoresSum) {
          currentTopThreeScoresSum = currentScoresSum;
          topStudent = scores.getKey();
        }
      }
    }
    return topStudent;
  }
Example #12
0
  private void readObject(java.io.ObjectInputStream in) throws IOException {
    float x = in.readFloat();
    float y = in.readFloat();
    float z = in.readFloat();
    String world = in.readUTF();
    World w = Spout.getEngine().getWorld(world);
    try {
      Field field;

      field = Vector3.class.getDeclaredField("x");
      field.setAccessible(true);
      field.set(this, x);

      field = Vector3.class.getDeclaredField("y");
      field.setAccessible(true);
      field.set(this, y);

      field = Vector3.class.getDeclaredField("z");
      field.setAccessible(true);
      field.set(this, z);

      field = Point.class.getDeclaredField("world");
      field.setAccessible(true);
      field.set(this, w);
    } catch (Exception e) {
      if (Spout.debugMode()) {
        e.printStackTrace();
      }
    }
  }
Example #13
0
 public void run() {
   try {
     in = new ObjectInputStream(new BufferedInputStream(socket.getInputStream()));
     while (!Thread.interrupted()) {
       String value = in.readUTF();
       if (ConfigSettings.instance().isActivateStats()) {
         StatsCommunication.instance().sent(value.getBytes().length);
       }
       if (ConfigSettings.instance().isDumpMessages()) {
         System.out.println("Received: " + value);
       }
       Message message = (Message) MessageSerializer.readMessage(value);
       consumer.receive(message);
     }
   } catch (Throwable t) {
     t.printStackTrace();
   } finally {
     consumer = null;
     try {
       out.close();
     } catch (IOException ex) {
       ex.printStackTrace();
     }
   }
 }
  /**
   * java.io.ObjectOutputStream#writeInt(int)
   * java.io.ObjectOutputStream#writeObject(java.lang.Object)
   * java.io.ObjectOutputStream#writeUTF(java.lang.String)
   */
  public void testMixPrimitivesAndObjects() throws Exception {
    int i = 7;
    String s1 = "string 1";
    String s2 = "string 2";
    byte[] bytes = {1, 2, 3};
    try {
      oos = new ObjectOutputStream(bao = new ByteArrayOutputStream());
      oos.writeInt(i);
      oos.writeObject(s1);
      oos.writeUTF(s2);
      oos.writeObject(bytes);
      oos.close();

      ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));

      int j = ois.readInt();
      assertTrue("Wrong int :" + j, i == j);

      String l1 = (String) ois.readObject();
      assertTrue("Wrong obj String :" + l1, s1.equals(l1));

      String l2 = ois.readUTF();
      assertTrue("Wrong UTF String :" + l2, s2.equals(l2));

      byte[] bytes2 = (byte[]) ois.readObject();
      assertTrue("Wrong byte[]", Arrays.equals(bytes, bytes2));
    } finally {
      try {
        if (oos != null) oos.close();
        if (ois != null) ois.close();
      } catch (IOException e) {
      }
    }
  }
  /**
   * 发送请求
   *
   * @param interfaceUrl
   * @param requestObject
   * @return
   * @throws IOException
   * @throws ClassNotFoundException
   */
  public static String post(String interfaceUrl, Serializable requestObject)
      throws IOException, ClassNotFoundException {
    String result = "";
    InputStream is = null;
    ObjectInputStream ois = null;
    try {
      URL url = new URL(interfaceUrl);
      URLConnection connection = url.openConnection();
      connection.setDoInput(true);
      connection.setDoOutput(true);
      connection.setConnectTimeout(5000);

      OutputStream os = connection.getOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(os);
      oos.writeObject(requestObject);

      is = connection.getInputStream();
      ois = new ObjectInputStream(is);
      result = ois.readUTF();
    } catch (RuntimeException e) {
      e.printStackTrace();
    } finally {
      if (is != null) {
        is.close();
        ois.close();
      }
    }

    return result;
  }
Example #16
0
 private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
   playerId = stream.readChar();
   event = (Event) stream.readObject();
   splitAction = (SPLIT_ACTION) stream.readObject();
   newOwner = stream.readUTF();
   leavers = (List<Character>) stream.readObject();
 }
 /** Reads an example set from the given input stream. */
 public SVMExamples(ObjectInputStream in) throws IOException {
   this(in.readInt(), in.readDouble());
   this.dim = in.readInt();
   String scaleString = in.readUTF();
   if (scaleString.equals("scale")) {
     int numberOfAttributes = in.readInt();
     this.meanVarianceMap = new HashMap<Integer, MeanVariance>();
     for (int i = 0; i < numberOfAttributes; i++) {
       int index = in.readInt();
       double mean = in.readDouble();
       double variance = in.readDouble();
       meanVarianceMap.put(Integer.valueOf(index), new MeanVariance(mean, variance));
     }
   }
   for (int e = 0; e < this.train_size; e++) {
     index[e] = new int[in.readInt()];
     atts[e] = new double[index[e].length];
     for (int a = 0; a < index[e].length; a++) {
       index[e][a] = in.readInt();
       atts[e][a] = in.readDouble();
     }
     alphas[e] = in.readDouble();
     ys[e] = in.readDouble();
   }
 }
Example #18
0
  public static void main(String args[]) throws Exception {
    byte key[] = password.getBytes();
    DESKeySpec desKeySpec = new DESKeySpec(key);
    SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
    SecretKey secretKey = keyFactory.generateSecret(desKeySpec);

    // Create cipher mode
    Cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
    desCipher.init(Cipher.DECRYPT_MODE, secretKey);

    // Create stream
    FileInputStream fis = new FileInputStream("out.txt");
    BufferedInputStream bis = new BufferedInputStream(fis);
    CipherInputStream cis = new CipherInputStream(bis, desCipher);
    ObjectInputStream ois = new ObjectInputStream(cis);

    // Read
    String plaintext2 = ois.readUTF();
    ois.close();

    // Compare
    System.out.println(plaintext);
    System.out.println(plaintext2);
    System.out.println("Identical? " + (plaintext.equals(plaintext2)));
  }
  private void readObject(final ObjectInputStream s)
      throws java.io.IOException, java.lang.ClassNotFoundException {

    s.defaultReadObject();
    String loggerName = s.readUTF();
    logger = Logger.getLogger(loggerName);
  }
  /**
   * 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();
    }
  }
  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);
  }
 /** java.io.ObjectOutputStream#writeUTF(java.lang.String) */
 public void test_writeUTFLjava_lang_String() throws Exception {
   // Test for method void
   // java.io.ObjectOutputStream.writeUTF(java.lang.String)
   oos.writeUTF("HelloWorld");
   oos.close();
   ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));
   assertEquals("Wrote incorrect UTF value", "HelloWorld", ois.readUTF());
 }
  public static WorkItem readWorkItem(MarshallerReaderContext context) throws IOException {
    ObjectInputStream stream = context.stream;

    WorkItemImpl workItem = new WorkItemImpl();
    workItem.setId(stream.readLong());
    workItem.setProcessInstanceId(stream.readLong());
    workItem.setName(stream.readUTF());
    workItem.setState(stream.readInt());

    // WorkItem Paramaters
    int nbVariables = stream.readInt();
    if (nbVariables > 0) {

      for (int i = 0; i < nbVariables; i++) {
        String name = stream.readUTF();
        try {
          int index = stream.readInt();
          ObjectMarshallingStrategy strategy = null;
          // Old way of retrieving strategy objects
          if (index >= 0) {
            strategy = context.resolverStrategyFactory.getStrategy(index);
            if (strategy == null) {
              throw new IllegalStateException("No strategy of with index " + index + " available.");
            }
          }
          // New way
          else if (index == -2) {
            String strategyClassName = stream.readUTF();
            strategy = context.resolverStrategyFactory.getStrategyObject(strategyClassName);
            if (strategy == null) {
              throw new IllegalStateException(
                  "No strategy of type " + strategyClassName + " available.");
            }
          }

          Object value = strategy.read(stream);
          workItem.setParameter(name, value);
        } catch (ClassNotFoundException e) {
          throw new IllegalArgumentException("Could not reload variable " + name);
        }
      }
    }

    return workItem;
  }
Example #24
0
 private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
   String str = s.readUTF();
   String[] args = null;
   java.util.Properties props = null;
   org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
   org.omg.CORBA.portable.Delegate delegate =
       ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate();
   _set_delegate(delegate);
 }
Example #25
0
  @Override
  public void lire(String source) {
    try (ObjectInputStream in =
        new ObjectInputStream(new BufferedInputStream(new FileInputStream(source)))) {
      String nom = (String) in.readUTF();
      String prenom = (String) in.readUTF();
      LocalDate birth = (LocalDate) in.readObject();
      String fonction = (String) in.readUTF();
      int telephone = (int) in.readInt();

      System.out.println(nom + " " + prenom + " " + birth + " " + fonction + " " + telephone);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Example #26
0
 private void readObject(java.io.ObjectInputStream s) {
   try {
     String str = s.readUTF();
     org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init().string_to_object(str);
     org.omg.CORBA.portable.Delegate delegate =
         ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate();
     _set_delegate(delegate);
   } catch (java.io.IOException e) {
   }
 }
Example #27
0
 private void readObject(ObjectInputStream objectinputstream)
     throws IOException, ClassNotFoundException {
   objectinputstream.defaultReadObject();
   super.level = objectinputstream.readInt();
   super.syslogEquivalent = objectinputstream.readInt();
   super.levelStr = objectinputstream.readUTF();
   if (super.levelStr == null) {
     super.levelStr = "";
   }
 }
Example #28
0
 /*     */ private void readObject(ObjectInputStream paramObjectInputStream)
     /*     */ throws IOException, ClassNotFoundException
       /*     */ {
   /* 553 */ Hashtable localHashtable = null;
   /*     */
   /* 555 */ paramObjectInputStream.defaultReadObject();
   /*     */
   /* 557 */ if (this.type == null) {
     /* 558 */ throw new NullPointerException("type can't be null");
     /*     */ }
   /*     */
   /* 561 */ int i = paramObjectInputStream.readInt();
   /* 562 */ if (i > 0)
   /*     */ {
     /* 565 */ localHashtable = new Hashtable(3);
     /* 566 */ this.certs = new Certificate[i];
     /*     */ }
   /*     */
   /* 569 */ for (int j = 0; j < i; j++)
   /*     */ {
     /* 572 */ String str = paramObjectInputStream.readUTF();
     /*     */ CertificateFactory localCertificateFactory;
     /* 573 */ if (localHashtable.containsKey(str))
     /*     */ {
       /* 575 */ localCertificateFactory = (CertificateFactory) localHashtable.get(str);
       /*     */ }
     /*     */ else {
       /*     */ try {
         /* 579 */ localCertificateFactory = CertificateFactory.getInstance(str);
         /*     */ } catch (CertificateException localCertificateException1) {
         /* 581 */ throw new ClassNotFoundException(
             "Certificate factory for " + str + " not found");
         /*     */ }
       /*     */
       /* 585 */ localHashtable.put(str, localCertificateFactory);
       /*     */ }
     /*     */
     /* 588 */ byte[] arrayOfByte = null;
     /*     */ try {
       /* 590 */ arrayOfByte = new byte[paramObjectInputStream.readInt()];
       /*     */ } catch (OutOfMemoryError localOutOfMemoryError) {
       /* 592 */ throw new IOException("Certificate too big");
       /*     */ }
     /* 594 */ paramObjectInputStream.readFully(arrayOfByte);
     /* 595 */ ByteArrayInputStream localByteArrayInputStream =
         new ByteArrayInputStream(arrayOfByte);
     /*     */ try {
       /* 597 */ this.certs[j] =
           localCertificateFactory.generateCertificate(localByteArrayInputStream);
       /*     */ } catch (CertificateException localCertificateException2) {
       /* 599 */ throw new IOException(localCertificateException2.getMessage());
       /*     */ }
     /* 601 */ localByteArrayInputStream.close();
     /*     */ }
   /*     */ }
  public Map<String, Object> readHashMap(String key) {
    Map<String, Object> res = new HashMap<String, Object>();
    int len = getLen(key);

    if (len == -1) return res;

    try {
      ByteArrayInputStream byteArrayStr =
          new ByteArrayInputStream(m_buff.array(), m_buff.position(), len);
      ObjectInputStream in = new ObjectInputStream(byteArrayStr);

      final int count = in.readInt();
      for (int i = 0; i < count; ++i) {
        String it_key = in.readUTF();
        int type = in.readInt();
        switch (type) {
          case BlobDataTypes.NULL:
            res.put(it_key, null);
            break;
          case BlobDataTypes.STRING:
            res.put(it_key, in.readUTF());
            break;
          case BlobDataTypes.INT:
            res.put(it_key, in.readInt());
            break;
          case BlobDataTypes.BOOLEAN:
            res.put(it_key, in.readBoolean());
            break;
          case BlobDataTypes.UNKNOWN:
          default:
            res.put(it_key, null);
            break;
        }
      }

      in.close();
      byteArrayStr.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return res;
  }
 @Override
 public Set<String> getAvailableTags() {
   Set<String> retValue = new HashSet<>();
   if (!file.exists()) {
     return retValue;
   }
   try (InputStream inputStream = new FileInputStream(file);
       ObjectInputStream objectInputStream = new ObjectInputStream(inputStream); ) {
     String tag = objectInputStream.readUTF();
     while (tag != null) {
       retValue.add(tag);
       tag = objectInputStream.readUTF();
     }
   } catch (EOFException ex) {
     // expected EOF
   } catch (IOException ex) {
     throw new RuntimeException(ex);
   }
   return retValue;
 }