Class GenericStream<T>

java.lang.Object
net.bluemind.core.rest.base.GenericStream<T>
All Implemented Interfaces:
io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>, io.vertx.core.streams.StreamBase

public abstract class GenericStream<T> extends Object implements io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>
  • Constructor Details

    • GenericStream

      public GenericStream()
  • Method Details

    • handler

      public GenericStream<T> handler(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> dataHandler)
      Specified by:
      handler in interface io.vertx.core.streams.ReadStream<T>
    • fetch

      public GenericStream<T> fetch(long amount)
      Specified by:
      fetch in interface io.vertx.core.streams.ReadStream<T>
    • pause

      public GenericStream<T> pause()
      Specified by:
      pause in interface io.vertx.core.streams.ReadStream<T>
    • resume

      public GenericStream<T> resume()
      Specified by:
      resume in interface io.vertx.core.streams.ReadStream<T>
    • exceptionHandler

      public GenericStream<T> exceptionHandler(io.vertx.core.Handler<Throwable> exceptionHandler)
      Specified by:
      exceptionHandler in interface io.vertx.core.streams.ReadStream<T>
      Specified by:
      exceptionHandler in interface io.vertx.core.streams.StreamBase
    • endHandler

      public GenericStream<T> endHandler(io.vertx.core.Handler<Void> endHandler)
      Specified by:
      endHandler in interface io.vertx.core.streams.ReadStream<T>
    • serialize

      protected abstract io.vertx.core.buffer.Buffer serialize(T n) throws Exception
      Throws:
      Exception
    • next

      protected abstract GenericStream.StreamState<T> next() throws Exception
      Throws:
      Exception
    • streamToString

      public static String streamToString(Stream stream)
    • streamToBytes

      public static byte[] streamToBytes(Stream stream)
    • asyncStreamToBuffer

      public static CompletableFuture<io.vertx.core.buffer.Buffer> asyncStreamToBuffer(Stream stream)
    • slowRead

      public static CompletableFuture<Void> slowRead(Stream stream)
    • streamToFile

      public static void streamToFile(Stream stream, File file)
    • streamToFile

      public static void streamToFile(Stream stream, File file, StandardOpenOption... opts)
    • asyncStreamToFile

      public static CompletableFuture<Void> asyncStreamToFile(Stream stream, File file, StandardOpenOption... opts)
    • asyncStreamToFile

      public static CompletableFuture<Void> asyncStreamToFile(io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer> reader, File file, StandardOpenOption... opts)
    • simpleValue

      public static <T> Stream simpleValue(T value, Function<T,byte[]> toByteArray)