Class Base58OutputStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

Provides Base58 encoding through a stream interface.

The default behavior of Base58InputStream is to decode, and the default behavior of Base58OutputStream is to encode. The builder can select either behavior with setEncode(boolean).

Results are available only after EOF. Decoding accepts at most Base58.DEFAULT_MAX_DECODE_LENGTH encoded bytes by default and throws IOException when an input chunk would exceed the cumulative limit. To configure the limit, pass a codec built with Base58.Builder.setMaxDecodeLength(int) to the stream builder's setBaseNCodec(Base58) method.

Encoding accepts at most Base58.DEFAULT_MAX_ENCODE_LENGTH binary bytes by default and throws IOException when an input chunk would exceed that cumulative limit. Configure it with Base58.Builder.setMaxEncodeLength(int) on the codec passed to setBaseNCodec(Base58).

The complete input is retained until EOF. Memory usage is proportional to the accumulated input and conversion output. Configure both input limits appropriately for larger trusted values; encoded output can exceed the decode limit.

Close the output stream or call BaseNCodecOutputStream.eof() after the last write to complete conversion.

Since:
1.22.0
See Also:
  • Constructor Details

    • Base58OutputStream

      public Base58OutputStream(OutputStream outputStream)
      Constructs a Base58OutputStream such that all data written is Base58-encoded to the original provided OutputStream.
      Parameters:
      outputStream - OutputStream to wrap.
  • Method Details