Static method to add the stream filter to a {@link Writer} object.

@throws InvalidArgumentException if the sequence is malformed
541460
public static function addTo(Writer $csv, string $sequence): Writer
    {
        self::register();

        if (!self::isValidSequence($sequence)) {
            throw new InvalidArgumentException('The sequence must contain at least one character to force enclosure');
        }

        $formatter = static function (array $record) use ($sequence) {
            foreach ($record as &$value) {
                $value = $sequence.$value;
            }
            unset($value);

            return $record;
        };

        return $csv
            ->addFormatter($formatter)
            ->addStreamFilter(self::FILTERNAME, ['sequence' => $sequence]);
    }
1355630
public void write(@NonNull MultiNormalizerStandardize normalizer, @NonNull OutputStream stream) throws IOException {
        try (DataOutputStream dos = new DataOutputStream(stream)) {
            dos.writeBoolean(normalizer.isFitLabel());
            dos.writeInt(normalizer.numInputs());
            dos.writeInt(normalizer.isFitLabel() ? normalizer.numOutputs() : -1);

            for (int i = 0; i < normalizer.numInputs(); i++) {
                Nd4j.write(normalizer.getFeatureMean(i), dos);
                Nd4j.write(normalizer.getFeatureStd(i), dos);
            }
            if (normalizer.isFitLabel()) {
                for (int i = 0; i < normalizer.numOutputs(); i++) {
                    Nd4j.write(normalizer.getLabelMean(i), dos);
                    Nd4j.write(normalizer.getLabelStd(i), dos);
                }
            }
            dos.flush();
        }
    }
534002
private void patternFilter(PatternDescrBuilder<?> pattern) throws RecognitionException {
        //        if ( input.LA( 1 ) == DRL6Lexer.PIPE ) {
        //            while ( input.LA( 1 ) == DRL6Lexer.PIPE ) {
        //                match( input,
        //                       DRL6Lexer.PIPE,
        //                       null,
        //                       null,
        //                       DroolsEditorType.SYMBOL );
        //                if ( state.failed ) return;
        //
        //                filterDef( pattern );
        //                if ( state.failed ) return;
        //            }
        //        } else {
        match(input,
                DRL6Lexer.ID,
                DroolsSoftKeywords.OVER,
                null,
                DroolsEditorType.KEYWORD);
        if (state.failed)
            return;

        filterDef(pattern);
        if (state.failed)
            return;
        //        }
    }
86610
protected void initializeFilter( InputStream filterInput, OutputStream filterOutput)
    {
    try
      {
      // Create Transformer object.
      Source transform = getTransform();
      if( transform == null)
        {
        throw new IllegalStateException( "No XSLT transform specified");
        }
      TransformerFactory factory = TransformerFactory.newInstance();
      factory.setErrorListener( this);
      
      transformer_ = factory.newTransformer( transform);
      transformer_.setErrorListener( this);
      if( transformParams_ != null)
        {
        for( String paramName : transformParams_.keySet())
          {
          transformer_.setParameter( paramName, transformParams_.get( paramName));
          }
        }
      
      transformSource_ = new StreamSource( filterInput);
      transformResult_ = new StreamResult( filterOutput);
      }
    catch( Exception e)
      {
      throw new RuntimeException( "Can't initialize filter", e);
      } 
    }
201356
protected void writeToSerializedStream(ObjectOutputStream stream) throws IOException {
        stream.writeLong(cas);
        stream.writeInt(expiry);
        stream.writeUTF(id);
        stream.writeObject(content);
        stream.writeObject(mutationToken);
    }
385583
@SuppressWarnings("unchecked")
	public void addWriter(RecordWriter<Record> writer)
	{
		// avoid using the array-list here to reduce one level of object indirection
		if (this.writers == null) {
			this.writers = new RecordWriter[] {writer};
		}
		else {
			RecordWriter<Record>[] ws = new RecordWriter[this.writers.length + 1];
			System.arraycopy(this.writers, 0, ws, 0, this.writers.length);
			ws[this.writers.length] = writer;
			this.writers = ws;
		}
	}
59198
public void writeToStream(OutputStream stream, Object object) throws SerializationException {
        try {
            mapper.writeValue(stream, object);
        } catch (IOException ex) {
            throw new SerializationException("Exception during serialization", ex);
        }
    }
157182
public function addStreamFilter($arg1, $arg2 = null)
    {
        $filter = null;
        $name = null;
        if ($arg2 === null) {
            $filter = $arg1;
        } else {
            $filter = $arg2;
            $name = $arg1;
        }
        $this->streamFilters[] = array($name, $filter);
    }
44952
function( writer, filter )
		{
			var text = this.value;

			if ( filter && !( text = filter.onText( text, this ) ) )
				return;

			writer.text( text );
		}
355662
private static StreamDescriptor copyStreamDescriptorWithSequence(StreamDescriptor streamDescriptor, int sequence)
    {
        List<StreamDescriptor> streamDescriptors = streamDescriptor.getNestedStreams().stream()
                .map(stream -> copyStreamDescriptorWithSequence(stream, sequence))
                .collect(toImmutableList());

        return new StreamDescriptor(
                streamDescriptor.getStreamName(),
                streamDescriptor.getStreamId(),
                streamDescriptor.getFieldName(),
                streamDescriptor.getStreamType(),
                streamDescriptor.getOrcDataSource(),
                streamDescriptors,
                sequence);
    }
141901
public void write(DataOutputStream stream, byte sequenceId) throws IOException {
        this.sequenceId = sequenceId;
        stream.write(PREAMBLE);
        stream.write(sequenceId);
        stream.write(action.getCode());
        stream.write(buffer.toArray());
        stream.write(Constants.EOD);
    }
1242116
protected void applyStreaming(ContainerRequestContext requestContext, WriterInterceptorContext context)
            throws IOException {

        Object entity = context.getEntity();
        StreamingProcess<Object> process = MessageHelper.getStreamingProcess(context.getEntity(), manager);

        if (process != null) {
            ContainerResponseContext responseContext =
                    (ContainerResponseContext) requestContext.getProperty(RESP_PROP_N);
            responseContext.setStatusInfo(Response.Status.PARTIAL_CONTENT);
            context.getHeaders().putSingle(ACCEPT_RANGES, BYTES_RANGE);
            context.setType(StreamingOutput.class);
            context.setEntity(new MediaStreaming(
                            entity,
                    requestContext.getHeaderString(MediaStreaming.RANGE),
                            process,
                            context.getMediaType(),
                            context.getHeaders()
                    )
            );
        }
    }
109061
public void addFilter(AbstractLogFilter<E> filter) {
                Validate.notNull(filter);
                filters.add(filter);
                uptodate = false;
                filter.addObserver(this);
        }
1004989
private static void writeStream(final InputStream input, final FileWriter writer)
            throws IOException
    {
        writeStream(input, writer, LineEndingStyle.LOCAL);
    }
793547
private void addGzipFilter() {
        FilterMapping filterMapping = new FilterMapping();
        filterMapping.setFilterName("gzip-filter");
        filterMapping.setPathSpec("/*");

        FilterHolder filterHolder = new FilterHolder(new GzipServletFilter());
        filterHolder.setName("gzip-filter");
        servletHandler.addFilter(filterHolder, filterMapping);
    }
1220881
protected void writeRaw(CharSequence seq, CharBuf buffer) {
        if (seq != null) {
            buffer.add(seq.toString());
        }
    }
1340029
public void xmlWriteOn(FormattedWriter writer) throws IOException
  {
    writer.newLine();
    writer.taggedValue("streamId", streamId);
    writer.newLine();
    writer.taggedValue("flushStarted", flushStarted);
  }