code: public static ReleasableInputStream wrap(InputStream is) {
          if (is instanceof ReleasableInputStream)
              return (ReleasableInputStream)is;   // already wrapped
          if (is instanceof FileInputStream)
              return ResettableInputStream.newResettableInputStream((FileInputStream)is);
          return new ReleasableInputStream(is);
      }
docs: Wraps the given input stream into a {@link ReleasableInputStream} if
  necessary. Note if the given input stream is a {@link FileInputStream}, a
  {@link ResettableInputStream} which is a specific subclass of
  {@link ReleasableInputStream} will be returned.