docs: public static ConsoleNote readFrom(DataInputStream in) throws IOException, ClassNotFoundException {
          try {
              byte[] preamble = new byte[PREAMBLE.length];
              in.readFully(preamble);
              if (!Arrays.equals(preamble,PREAMBLE))
                  return null;    // not a valid preamble
  
              DataInputStream decoded = new DataInputStream(new UnbufferedBase64InputStream(in));
              int macSz = - decoded.readInt();
              byte[] mac;
              int sz;
              if (macSz > 0) { // new format
                  mac = new byte[macSz];
                  decoded.readFully(mac);
                  sz = decoded.readInt();
                  if (sz < 0) {
                      throw new IOException("Corrupt stream");
                  }
              } else {
                  mac = null;
                  sz = - macSz;
              }
              byte[] buf = new byte[sz];
              decoded.readFully(buf);
  
              byte[] postamble = new byte[POSTAMBLE.length];
              in.readFully(postamble);
              if (!Arrays.equals(postamble,POSTAMBLE))
                  return null;    // not a valid postamble
  
              if (!INSECURE) {
                  if (mac == null) {
                      throw new IOException("Refusing to deserialize unsigned note from an old log.");
                  } else if (!MAC.checkMac(buf, mac)) {
                      throw new IOException("MAC mismatch");
                  }
              }
  
              Jenkins jenkins = Jenkins.getInstance();
              try (ObjectInputStream ois = new ObjectInputStreamEx(new GZIPInputStream(new ByteArrayInputStream(buf)),
                      jenkins != null ? jenkins.pluginManager.uberClassLoader : ConsoleNote.class.getClassLoader(),
                      ClassFilter.DEFAULT)) {
                  return (ConsoleNote) ois.readObject();
              }
          } catch (Error e) {
              // for example, bogus 'sz' can result in OutOfMemoryError.
              // package that up as IOException so that the caller won't fatally die.
              throw new IOException(e);
          }
      }