Code example for ObjectInput

Methods: readObject

0
      output.writeObject(list.get(0));
   } 
 
   @Override 
   public List<?> readObject(ObjectInput input) throws IOException, ClassNotFoundException {
      return Collections.singletonList(input.readObject());
   } 
 
   @Override 
   public Integer getId() {
      return Ids.SINGLETON_LIST; 
   } 
 
   @Override 
   public Set<Class<? extends List<?>>> getTypeClasses() {
      // This is loadable from any classloader 
      return Util.<Class<? extends List<?>>>asSet(Util.<List<?>>loadClass("java.util.Collections$SingletonList", null));
   } 
 
} 
Experience pair programming with AI  Get Codota for Java