code: private static boolean attemptToSerialize(final Object o) {
          final OutputStream sink;
          ObjectOutputStream stream;
  
          stream = null;
  
          try {
              sink = new ByteArrayOutputStream();
              stream = new ObjectOutputStream(sink);
              stream.writeObject(o);
              // could also re-serilalize at this point too
          } catch (final IOException ex) {
              return false;
          } finally {
              if (stream != null) {
                  try {
                      stream.close();
                  } catch (final IOException ex) {
                      // should not be able to happen
                  }
              }
          }
  
          return true;
      }
docs: Attempt to serialize.
  
  @param o
  the o
  @return true, if successful