Code example for ObjectInput

Methods: readUnsignedBytereadObject

0
      MarshallUtil.marshallMap(map, output);
   } 
 
   @Override 
   public Map doReadObject(ObjectInput input) throws IOException, ClassNotFoundException {
      int magicNumber = input.readUnsignedByte();
      Map subject = null;
      switch (magicNumber) {
         case HASHMAP:
            subject = new HashMap();
            break; 
         case TREEMAP:
            subject = new TreeMap();
            break; 
         case FASTCOPYHASHMAP:
            subject = new FastCopyHashMap();
            break; 
         case EQUIVALENTHASHMAP:
            Equivalence<Object> keyEq = (Equivalence<Object>) input.readObject();
            Equivalence<Object> valueEq = (Equivalence<Object>) input.readObject();
            subject = new EquivalentHashMap(keyEq, valueEq);
            break; 
      } 
      MarshallUtil.unmarshallMap(subject, input);
      return subject;
Experience pair programming with AI  Get Codota for Java