code: public static SeekableInputStream create(InputStream input) throws IOException {
      if (input instanceof SeekableInputStream) {
        return (SeekableInputStream) input;
      }
      if (input instanceof FileInputStream) {
        return create((FileInputStream) input);
      }
      if (input instanceof Seekable) {
        final Seekable seekable = (Seekable) input;
        return new SeekableInputStream(input) {
          @Override
          public void seek(long pos) throws IOException {
            seekable.seek(pos);
          }
  
          @Override
          public long getPos() throws IOException {
            return seekable.getPos();
          }
  
          @Override
          public boolean seekToNewSource(long targetPos) throws IOException {
            return seekable.seekToNewSource(targetPos);
          }
        };
      }
  
      throw new IOException("Failed to create SeekableInputStream from " + input.getClass());
    }
docs: Creates a {@link SeekableInputStream} from the given {@link java.io.InputStream}. Exception will be
  thrown if failed to do so.
  
  @throws java.io.IOException If the given input stream is not seekable.