IO対決
さらっと見たところguavaのio(GIO)とcommons-io(CIO)の差異は
- GIOには埋め込みリソースに対する便利メソッド集あり(com.google.common.io.Resources)
- CIOにはgetExtention、removeExtension、wildcardMatchあり(org.apache.commons.io.FilenameUtils)
くらいかな。
イメージとしては、
GIOは、File→Byte(文字)、Byte→Fileがcommons-io並に揃っていて
CIOにはそれに加えてcopyURLToFileやファイル監視、ドライブ空き容量取得等、ファイル単位(?)での処理が揃っている
という感じ。
guavaには、Predicate
これを使いこなすとカッコイイけど、Java初心者がプロジェクトに入ったりすると壁を感じてしまうかも。
langの方はたまに使う程度だから、比較はいっかな。
guavaの例を探していたら見つけたサイトの記事。
The Guava library for java; what are its most useful and/or hidden features - Stack Overflow
I've been effectively using Guava for a couple of years,
inside Google - and it's wonderful.The parts I'm particularly fond of are:
Charsets.* - so simple, so useful
Collections
IO handling (read a resource completely in a single line, etc)
Splitter/Joiner
Preconditions
CharMatcher.inRange('a','z').or(inRange('A','Z'));
CharMatcher complexMatcher = CharMatcher.anyOf("cat")
.or(CharMatcher.DIGIT)
.or(CharMatcher.WHITESPACE)
.precomputed();
評判はいいみたい。