Пример #1
0
 /** The opposite operation of {@link #writePreamble(OutputStream)}. */
 public static Capability read(InputStream is) throws IOException {
   try {
     ObjectInputStream ois = new ObjectInputStream(Mode.TEXT.wrap(is));
     return (Capability) ois.readObject();
   } catch (ClassNotFoundException e) {
     throw (Error) new NoClassDefFoundError(e.getMessage()).initCause(e);
   }
 }
Пример #2
0
 /** Writes out the capacity preamble. */
 void writePreamble(OutputStream os) throws IOException {
   os.write(PREAMBLE);
   ObjectOutputStream oos = new ObjectOutputStream(Mode.TEXT.wrap(os));
   oos.writeObject(this);
   oos.flush();
 }