### Question:
RFC2616Codec implements ICharArrayCodec { public void decode (@Nullable final char [] aEncodedBuffer, @Nonnegative final int nOfs, @Nonnegative final int nLen, @Nonnull @WillNotClose final Writer aWriter) { if (aEncodedBuffer == null) return; if (nLen < 2) throw new DecodeException ("At least the 2 quote characters must be present. Provided length is only " + nLen); if (aEncodedBuffer[nOfs] != QUOTE_CHAR) throw new DecodeException ("The provided bytes does not seem to be encoded. The first byte is not the double quote character."); final int nLastOfs = nOfs + nLen - 1; if (aEncodedBuffer[nLastOfs] != QUOTE_CHAR) throw new DecodeException ("The provided bytes does not seem to be encoded. The last byte is not the double quote character."); try { for (int i = nOfs + 1; i < nLastOfs; ++i) { final char c = aEncodedBuffer[i]; if (c == ESCAPE_CHAR) { if (i == nLastOfs - 1) throw new DecodeException ("The encoded string seems to be cut. The second last character cannot be an escape character."); ++i; aWriter.write (aEncodedBuffer[i]); } else aWriter.write (c); } } catch (final IOException ex) { throw new DecodeException ("Failed to decode RFC2616", ex); } } RFC2616Codec(); static boolean isToken(@Nullable final String s); static boolean isToken(@Nullable final char [] aChars); static boolean isMaybeEncoded(@Nullable final String s); static boolean isMaybeEncoded(@Nullable final char [] s); @Nonnegative @Override int getMaximumEncodedLength(@Nonnegative final int nDecodedLen); void encode(@Nullable final char [] aDecodedBuffer,
                      @Nonnegative final int nOfs,
                      @Nonnegative final int nLen,
                      @Nonnull @WillNotClose final Writer aWriter); @Nonnegative @Override int getMaximumDecodedLength(@Nonnegative final int nEncodedLen); void decode(@Nullable final char [] aEncodedBuffer,
                      @Nonnegative final int nOfs,
                      @Nonnegative final int nLen,
                      @Nonnull @WillNotClose final Writer aWriter);  }### Answer:
@Test public void testDecode () { final RFC2616Codec aCodec = new RFC2616Codec (); assertNull (aCodec.getDecodedAsString ((char []) null)); assertNull (aCodec.getDecodedAsString ((String) null)); assertEquals ("", aCodec.getDecodedAsString ("\"\"")); assertEquals ("abc", aCodec.getDecodedAsString ("\"abc\"")); assertEquals ("a b c", aCodec.getDecodedAsString ("\"a b c\"")); assertEquals (" \\ \" ", aCodec.getDecodedAsString ("\" \\\\ \\\" \"")); try { aCodec.getDecoded ("\""); fail (); } catch (final DecodeException ex) {} try { aCodec.getDecoded ("\"abc"); fail (); } catch (final DecodeException ex) {} try { aCodec.getDecoded ("abc"); fail (); } catch (final DecodeException ex) {} }