Package com.yahoo.io

Class AbstractByteWriter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected BufferChain buffer  
      protected java.nio.CharBuffer charBuffer  
      protected java.nio.charset.CharsetEncoder encoder  
      • Fields inherited from class java.io.Writer

        lock
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractByteWriter​(java.nio.charset.CharsetEncoder encoder)  
    • Field Detail

      • encoder

        protected final java.nio.charset.CharsetEncoder encoder
      • charBuffer

        protected final java.nio.CharBuffer charBuffer
    • Constructor Detail

      • AbstractByteWriter

        protected AbstractByteWriter​(java.nio.charset.CharsetEncoder encoder)
    • Method Detail

      • getEncoding

        public java.nio.charset.Charset getEncoding()
        Returns the charset this encodes its output in
      • write

        public void write​(int v)
                   throws java.io.IOException
        Do note, if writing the first character of a surrogate pair, the next character written must be the second part of the pair. If this is not the case, the surrogate will be omitted from output.
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(char[] cbuf,
                          int offset,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • append

        public void append​(java.nio.ByteBuffer alreadyEncoded)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • append

        public void append​(byte alreadyEncoded)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • append

        public void append​(byte[] alreadyEncoded)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • append

        public void append​(byte[] alreadyEncoded,
                           int offset,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • appended

        public long appended()
        Return the number of bytes this writer will produce for the underlying layer. That is, it sums the length of the raw bytes received and the number of bytes in the written strings after encoding.
        Returns:
        the number of bytes appended to this writer