StringUtf8Coder (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

com.google.cloud.dataflow.sdk.coders

Class StringUtf8Coder

    • Method Detail

      • encode

        public void encode(String value,
                           OutputStream outStream,
                           Coder.Context context)
                    throws IOException
        Description copied from interface: Coder
        Encodes the given value of type T onto the given output stream in the given context.
        Throws:
        IOException - if writing to the OutputStream fails for some reason
        CoderException - if the value could not be encoded for some reason
      • decode

        public String decode(InputStream inStream,
                             Coder.Context context)
                      throws IOException
        Description copied from interface: Coder
        Decodes a value of type T from the given input stream in the given context. Returns the decoded value.
        Throws:
        IOException - if reading from the InputStream fails for some reason
        CoderException - if the value could not be decoded for some reason
      • consistentWithEquals

        public boolean consistentWithEquals()
        Returns true if this Coder is injective with respect to Object.equals(java.lang.Object).

        Whenever the encoded bytes of two values are equal, then the original values are equal according to Objects.equals(). Note that this is well-defined for null.

        This condition is most notably false for arrays. More generally, this condition is false whenever equals() compares object identity, rather than performing a semantic/structural comparison.

        Specified by:
        consistentWithEquals in interface Coder<String>
        Overrides:
        consistentWithEquals in class StandardCoder<String>
        Returns:
        true. This coder is injective.
      • getEncodedElementByteSize

        protected long getEncodedElementByteSize(String value,
                                                 Coder.Context context)
                                          throws Exception
        Returns the size in bytes of the encoded value using this coder.
        Overrides:
        getEncodedElementByteSize in class StandardCoder<String>
        Returns:
        the byte size of the UTF-8 encoding of the a string or, in a nested context, the byte size of the encoding plus the encoded length prefix.
        Throws:
        Exception


Send feedback about...

Cloud Dataflow