クラス StringDecoder
java.lang.ObjectSE
org.springframework.core.codec.AbstractDecoder<T>
org.springframework.core.codec.AbstractDataBufferDecoder<StringSE>
org.springframework.core.codec.StringDecoder
データバッファストリームから
String
ストリームにデコードし、受信データチャンクを分割または集約して、改行区切り記号に沿って再配置し、文字列のストリームを生成します。これはストリーミングに役立ちますが、分割文字の課題を回避して、マルチバイト文字を正しくデコードできるようにするためにも必要です。デフォルトで使用されるデフォルトの区切り文字は \n
と \r\n
ですが、カスタマイズ可能です。- 導入:
- 5.0
- 作成者:
- Sebastien Deleuze, Brian Clozel, Arjen Poutsma, Mark Paluch
- 関連事項:
フィールドサマリー
フィールドクラス org.springframework.core.codec.AbstractDecoder から継承されたフィールド
logger
メソッドのサマリー
修飾子と型メソッド説明static StringDecoder
すべての MIME 型をサポートするStringDecoder
を作成します。static StringDecoder
allMimeTypes
(ListSE<StringSE> delimiters, boolean stripDelimiter) すべての MIME 型をサポートするStringDecoder
を作成します。boolean
canDecode
(ResolvableType elementType, MimeType mimeType) デコーダーが特定のターゲット要素型とソースストリームの MIME 型をサポートするかどうか。reactor.core.publisher.Flux<StringSE>
decode
(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, MapSE<StringSE, ObjectSE> hints) DataBuffer
入力ストリームをT
の Flux にデコードします。decode
(DataBuffer dataBuffer, ResolvableType elementType, MimeType mimeType, MapSE<StringSE, ObjectSE> hints) データバッファを型 T のオブジェクトにデコードします。設定されたdefaultCharset
を返します。void
setDefaultCharset
(CharsetSE defaultCharset) MimeType で何も指定されていない場合は、デフォルトの文字セットをフォールバックするように設定します。static StringDecoder
"text/plain"
のStringDecoder
を作成します。static StringDecoder
textPlainOnly
(ListSE<StringSE> delimiters, boolean stripDelimiter) "text/plain"
のStringDecoder
を作成します。クラス org.springframework.core.codec.AbstractDataBufferDecoder から継承されたメソッド
decodeDataBuffer, decodeToMono, getMaxInMemorySize, setMaxInMemorySize
クラス org.springframework.core.codec.AbstractDecoder から継承されたメソッド
getDecodableMimeTypes, getLogger, setLogger
クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSE
インターフェース org.springframework.core.codec.Decoder から継承されたメソッド
getDecodableMimeTypes
フィールドの詳細
DEFAULT_CHARSET
使用するデフォルトの文字セット、つまり "UTF-8"。DEFAULT_DELIMITERS
使用するデフォルトの区切り文字列、つまり\r\n
および\n
。
メソッドの詳細
setDefaultCharset
MimeType で何も指定されていない場合は、デフォルトの文字セットをフォールバックするように設定します。デフォルトでは、これは
UTF-8
です。- パラメーター:
defaultCharset
- フォールバックする文字セット- 導入:
- 5.2.9
getDefaultCharset
設定されたdefaultCharset
を返します。- 導入:
- 5.2.9
canDecode
インターフェースからコピーされた説明:Decoder
デコーダーが特定のターゲット要素型とソースストリームの MIME 型をサポートするかどうか。decode
public reactor.core.publisher.Flux<StringSE> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable MapSE<StringSE, ObjectSE> hints) インターフェースからコピーされた説明:Decoder
DataBuffer
入力ストリームをT
の Flux にデコードします。- 次で指定:
- インターフェース
Decoder<StringSE>
のdecode
- オーバーライド:
- クラス
AbstractDataBufferDecoder<StringSE>
のdecode
- パラメーター:
input
- デコードするDataBuffer
入力ストリームelementType
- 出力ストリーム内の要素の予想される型。この型は、事前にDecoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
メソッドに渡されている必要があり、true
を返している必要があります。mimeType
- 入力ストリームに関連付けられた MIME 型 (オプション)hints
- デコード方法に関する追加情報- 戻り値:
- デコードされた要素を含む出力ストリーム
decode
public StringSE decode(DataBuffer dataBuffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable MapSE<StringSE, ObjectSE> hints) インターフェースからコピーされた説明:Decoder
データバッファーを型 T のオブジェクトにデコードします。これは、個別のメッセージ(またはイベント)が完全に集約された形式で個別にデコードおよび処理されるシナリオで役立ちます。- パラメーター:
dataBuffer
- デコードするDataBuffer
elementType
- 予想される出力型mimeType
- データに関連付けられた MIME 型hints
- デコード方法に関する追加情報- 戻り値:
- デコードされた値、おそらく
null
textPlainOnly
"text/plain"
のStringDecoder
を作成します。textPlainOnly
"text/plain"
のStringDecoder
を作成します。- パラメーター:
delimiters
- 入力ストリームを分割するために使用する区切り文字列stripDelimiter
- 結果の入力文字列から区切り文字を削除するかどうか
allMimeTypes
すべての MIME 型をサポートするStringDecoder
を作成します。allMimeTypes
すべての MIME 型をサポートするStringDecoder
を作成します。- パラメーター:
delimiters
- 入力ストリームを分割するために使用する区切り文字列stripDelimiter
- 結果の入力文字列から区切り文字を削除するかどうか