@Override public Map<String, Object> hints() { return Hints.from(Hints.LOG_PREFIX_HINT, logPrefix); } });
/** * Create a {@code StringDecoder} that supports all MIME types. */ public static StringDecoder allMimeTypes() { return allMimeTypes(DEFAULT_DELIMITERS, true); }
/** * Create a {@code StringDecoder} for {@code "text/plain"}. */ public static StringDecoder textPlainOnly() { return textPlainOnly(DEFAULT_DELIMITERS, true); }
public ResourceHttpMessageWriter(int bufferSize) { this.encoder = new ResourceEncoder(bufferSize); this.regionEncoder = new ResourceRegionEncoder(bufferSize); this.mediaTypes = MediaType.asMediaTypes(this.encoder.getEncodableMimeTypes()); }
@Override public Flux<String> decode(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) { List<byte[]> delimiterBytes = getDelimiterBytes(mimeType); Flux<DataBuffer> inputFlux = Flux.from(inputStream) .flatMapIterable(dataBuffer -> splitOnDelimiter(dataBuffer, delimiterBytes)) .bufferUntil(StringDecoder::isEndFrame) .map(StringDecoder::joinUntilEndFrame) .doOnDiscard(PooledDataBuffer.class, DataBufferUtils::release); return super.decode(inputFlux, elementType, mimeType, hints); }
public ByteBufferEncoderTests() { super(new ByteBufferEncoder()); }
public ByteArrayDecoderTests() { super(new ByteArrayDecoder()); }
public ByteBufferDecoderTests() { super(new ByteBufferDecoder()); }
public CharSequenceEncoderTests() { super(CharSequenceEncoder.textPlainOnly()); }
public ResourceDecoderTests() { super(new ResourceDecoder()); }
public ByteArrayEncoderTests() { super(new ByteArrayEncoder()); }
/** * Create a {@code CharSequenceEncoder} that supports only "text/plain". */ public static CharSequenceEncoder textPlainOnly() { return new CharSequenceEncoder(new MimeType("text", "plain", DEFAULT_CHARSET)); }
/** * Create a {@code StringDecoder} for {@code "text/plain"}. * @param delimiters delimiter strings to use to split the input stream * @param stripDelimiter whether to remove delimiters from the resulting * input strings */ public static StringDecoder textPlainOnly(List<String> delimiters, boolean stripDelimiter) { return new StringDecoder(delimiters, stripDelimiter, new MimeType("text", "plain", DEFAULT_CHARSET)); }
public ResourceEncoderTests() { super(new ResourceEncoder()); }
public DataBufferEncoderTests() { super(new DataBufferEncoder()); }
public DataBufferDecoderTests() { super(new DataBufferDecoder()); }
public StringDecoderTests() { super(StringDecoder.allMimeTypes()); }
/** * Create a {@code StringDecoder} for {@code "text/plain"}. * @param ignored ignored * @deprecated as of Spring 5.0.4, in favor of {@link #textPlainOnly()} or * {@link #textPlainOnly(List, boolean)} */ @Deprecated public static StringDecoder textPlainOnly(boolean ignored) { return textPlainOnly(); }
/** * Create a {@code CharSequenceEncoder} that supports all MIME types. */ public static CharSequenceEncoder allMimeTypes() { return new CharSequenceEncoder(new MimeType("text", "plain", DEFAULT_CHARSET), MimeTypeUtils.ALL); }
/** * Create a {@code StringDecoder} that supports all MIME types. * @param delimiters delimiter strings to use to split the input stream * @param stripDelimiter whether to remove delimiters from the resulting * input strings */ public static StringDecoder allMimeTypes(List<String> delimiters, boolean stripDelimiter) { return new StringDecoder(delimiters, stripDelimiter, new MimeType("text", "plain", DEFAULT_CHARSET), MimeTypeUtils.ALL); }