code: @SuppressWarnings("unchecked")
      public static Stream<Statement> encode(final Stream<? extends Record> stream,
              @Nullable final Iterable<? extends URI> types) {
          Preconditions.checkNotNull(stream);
          if (types != null) {
              stream.setProperty("types", types);
          }
          final Stream<Record> records = (Stream<Record>) stream;
          return records.transform(null, new Function<Handler<Statement>, Handler<Record>>() {
  
              @Override
              public Handler<Record> apply(final Handler<Statement> handler) {
                  final Iterable<? extends URI> types = stream.getProperty("types", Iterable.class);
                  return new Encoder(handler, types);
              }
  
          });
      }
docs: Performs record-to-RDF encoding by converting a stream of records in a stream of RDF
  statements. Parameter {@code types} specify additional types to be added to encoded
  records. Type information may be set to null (e.g., because unknown at the time the method
  is called): in this case, it will be read from metadata attribute {@code "types"} attached
  to the stream; reading will happen just before decoding will take place, i.e., when a
  terminal stream operation will be called.
  
  @param stream
  the stream of records to encode.
  @param types
  the types to be added to each record of the stream, null if to be read from
  stream metadata
  @return the resulting stream of statements