Class CapturingInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.projectnessie.client.rest.io.CapturingInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public final class CapturingInputStream extends FilterInputStream
Captures the first 2kB of the input in case the response is not parsable, to provide a better error message to the user.
  • Constructor Details

    • CapturingInputStream

      public CapturingInputStream(InputStream delegate)
  • Method Details

    • read

      public int read(byte[] b, int off, int len) throws IOException
      Overrides:
      read in class FilterInputStream
      Throws:
      IOException
    • read

      public int read() throws IOException
      Overrides:
      read in class FilterInputStream
      Throws:
      IOException
    • capture

      public String capture()
      Consumes the input stream up to 2048 bytes and returns the captured content as a string. This method does not close the input stream.
    • captured

      public String captured()
      Returns the captured content so far, as a string. This method does not consume and does not close the input stream.