code: public static <T extends Serializable> Flowable<T> write(final Flowable<T> source, final File file,
              final boolean append, final int bufferSize) {
          Callable<ObjectOutputStream> resourceFactory = new Callable<ObjectOutputStream>() {
              @Override
              public ObjectOutputStream call() throws IOException {
                  return new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file, append), bufferSize));
              }
          };
          Function<ObjectOutputStream, Flowable<T>> flowableFactory = new Function<ObjectOutputStream, Flowable<T>>() {
  
              @Override
              public Flowable<T> apply(ObjectOutputStream oos) {
                  return write(source, oos);
              }
          };
          Consumer<ObjectOutputStream> disposeAction = Consumers.close();
          return Flowable.using(resourceFactory, flowableFactory, disposeAction, true);
      }
docs: Writes the source stream to the given file in given append mode and using
  the given buffer size.
  
  @param source
  flowable stream to write
  @param file
  file to write to
  @param append
  if true writes are appended to file otherwise overwrite the
  file
  @param bufferSize
  the buffer size in bytes to use.
  @param <T>
  the generic type of the input stream
  @return re-emits the input stream