public final <E extends T> boolean write(OutputStream out, E persist, Object... args) {
    if (out != null) {
      ObjectOutput oos = null;
      final Object[] stack = SerializationProxy.swapExtraArguments(args);
      try {
        oos = out instanceof ObjectOutputStream? (ObjectOutputStream) out : new ObjectOutputStream(out);
        oos.writeObject(persist);
        return true;
      } catch (IOException xio) {
        writeError(xio, "error writing stream " + out);
      } finally {
        SerializationProxy.swapExtraArguments(stack);
        if (oos != null) {
          try {
            oos.close();
          } catch (IOException xio) {
            writeWarning(xio, "closing object stream: ");
          }
        }
      }
    }
    return false;
  }
Saves an object to persistent storage.

@param <E> the class of the object to persist
@param out     the stream to write to
@param persist the object to serialize
@param args    the proxy arguments
@return true if successful, false if file is null
@throws SerializationProxy.ProxyException in case of low level error
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/properties/Serializer.java