Interface PrimitiveSink

  • All Known Subinterfaces:
    Hasher

    @Beta
    public interface PrimitiveSink
    An object which can receive a stream of primitive values.
    Since:
    12.0 (in 11.0 as Sink)
    • Method Detail

      • putByte

        PrimitiveSink putByte​(byte b)
        Puts a byte into this sink.
        Parameters:
        b - a byte
        Returns:
        this instance
      • putBytes

        PrimitiveSink putBytes​(byte[] bytes)
        Puts an array of bytes into this sink.
        Parameters:
        bytes - a byte array
        Returns:
        this instance
      • putBytes

        PrimitiveSink putBytes​(byte[] bytes,
                               int off,
                               int len)
        Puts a chunk of an array of bytes into this sink. bytes[off] is the first byte written, bytes[off + len - 1] is the last.
        Parameters:
        bytes - a byte array
        off - the start offset in the array
        len - the number of bytes to write
        Returns:
        this instance
        Throws:
        java.lang.IndexOutOfBoundsException - if off < 0 or off + len > bytes.length or len < 0
      • putShort

        PrimitiveSink putShort​(short s)
        Puts a short into this sink.
      • putInt

        PrimitiveSink putInt​(int i)
        Puts an int into this sink.
      • putLong

        PrimitiveSink putLong​(long l)
        Puts a long into this sink.
      • putFloat

        PrimitiveSink putFloat​(float f)
        Puts a float into this sink.
      • putDouble

        PrimitiveSink putDouble​(double d)
        Puts a double into this sink.
      • putBoolean

        PrimitiveSink putBoolean​(boolean b)
        Puts a boolean into this sink.
      • putChar

        PrimitiveSink putChar​(char c)
        Puts a character into this sink.
      • putString

        @Deprecated
        PrimitiveSink putString​(java.lang.CharSequence charSequence)
        Deprecated.
        Use {PrimitiveSink#putUnencodedChars} instead. This method is scheduled for removal in Guava 16.0.
        Puts a string into this sink.
      • putUnencodedChars

        PrimitiveSink putUnencodedChars​(java.lang.CharSequence charSequence)
        Puts each 16-bit code unit from the CharSequence into this sink.
        Since:
        15.0 (since 11.0 as putString(CharSequence))
      • putString

        PrimitiveSink putString​(java.lang.CharSequence charSequence,
                                java.nio.charset.Charset charset)
        Puts a string into this sink using the given charset.