Interface IByteArrayStreamDecoder

    • Method Detail

      • decode

        default void decode​(@Nullable
                            byte[] aEncodedBuffer,
                            @Nonnull @WillNotClose
                            OutputStream aOS)
        Decode a byte array.
        Parameters:
        aEncodedBuffer - The byte array to be decoded. May be null.
        aOS - The output stream to write to. May not be null and is NOT closed afterwards!
        Throws:
        DecodeException - in case something goes wrong
        Since:
        9.0.0
      • decode

        void decode​(@Nullable
                    byte[] aEncodedBuffer,
                    @Nonnegative
                    int nOfs,
                    @Nonnegative
                    int nLen,
                    @Nonnull @WillNotClose
                    OutputStream aOS)
        Decode (part of) a byte array.
        Parameters:
        aEncodedBuffer - The byte array to be decoded. May be null.
        nOfs - Offset into the byte array to start from.
        nLen - Number of bytes starting from offset to consider.
        aOS - The output stream to write to. May not be null and is NOT closed afterwards!
        Throws:
        DecodeException - in case something goes wrong
      • getDecoded

        @Nullable
        @ReturnsMutableCopy
        default byte[] getDecoded​(@Nullable
                                  byte[] aEncodedBuffer,
                                  @Nonnegative
                                  int nOfs,
                                  @Nonnegative
                                  int nLen)
        Decode a byte array.
        Specified by:
        getDecoded in interface IByteArrayDecoder
        Parameters:
        aEncodedBuffer - The byte array to be decoded. May be null.
        nOfs - Offset into the byte array to start from.
        nLen - Number of bytes starting from offset to consider.
        Returns:
        The decoded byte array or null if the parameter was null.
        Throws:
        DecodeException - in case something goes wrong
      • getDecodedAsString

        @Nullable
        default String getDecodedAsString​(@Nullable
                                          String sEncoded,
                                          @Nonnull
                                          Charset aCharset)
        Decode the passed string.
        Parameters:
        sEncoded - The string to be decoded. May be null.
        aCharset - The charset to be used for encoding AND decoding. May not be null.
        Returns:
        null if the input string is null.
        Throws:
        DecodeException - in case something goes wrong
      • getDecodedAsString

        @Nullable
        default String getDecodedAsString​(@Nullable
                                          String sEncoded,
                                          @Nonnull
                                          Charset aEncodedCharset,
                                          @Nonnull
                                          Charset aDecodedCharset)
        Decode the passed string.
        Parameters:
        sEncoded - The string to be decoded. May be null.
        aEncodedCharset - The charset to be used for the encoded string. May not be null.
        aDecodedCharset - The charset to be used for the decoded result string. May not be null.
        Returns:
        null if the input string is null.
        Throws:
        DecodeException - in case something goes wrong
        Since:
        9.3.6