tips/JAVA/Throwable printStackTrace() の結果を文字列として取り出す(追記) の変更点
- 追加された行はこの色です。
- 削除された行はこの色です。
- tips/JAVA/Throwable printStackTrace() の結果を文字列として取り出す(追記) へ行く。
- tips/JAVA/Throwable printStackTrace() の結果を文字列として取り出す(追記) の差分を削除
[[tips/JAVA/Throwable printStackTrace() の結果を文字列として取り出す(2 of 2)]]
#navi(../)
* Throwable printStackTrace() の結果を文字列として取り出す(追記) [#n12ec0ad]
以前書いた
> [[tips/JAVA/Throwable printStackTrace() の結果を文字列として取り出す(1 of 2)]]~
[[tips/JAVA/Throwable printStackTrace() の結果を文字列として取り出す(2 of 2)]]
について、PipedReader/Writer を用いて実現しようとしていましたが、
もっと簡便な方法がありました。。。
Throwable#printStackTrace(PrintWriter) の引数に渡す PrintWriter に
StringWriter を使えばよいようです。
StringWriter なんて便利なクラスがあったんですね。。。
ちなみにマルチスレッドでの挙動は確認していません。