package Ġcom . orge cc . util . text file Ċ Ċ import Ġcom . orge cc . util . io . IO With Digest Ċ import Ġcom . orge cc . util . io . digest InputStream Ċ import Ġcom . orge cc . util . io . digest OutputStream Ċ import Ġorg . bean io . Bean Reader Ċ import Ġorg . bean io . Bean Writer Ċ import Ġorg . bean io . Stream Factory Ċ import Ġjava . io . Reader Ċ import Ġjava . io . Writer Ċ import Ġjava . nio . file . Path Ċ import Ġjava . security . Message Digest Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġelif ar ley Ġon Ġ 2 4 / 0 8 / 1 6 . Ċ Ġ*/ Ċ Ċ fun Ġuse New Bean IO Reader Pre Kotlin 1 dot 1 ( stream Name : ĠString , ĠfilePath : ĠPath , Ġblock : Ġ( IO With Digest . MD Reader ) Ġ-> ĠUnit ) Ġ= ĊĠĠĠĠĠĠĠ ĠBean IO Kit . use NewReader ( stream Name , ĠfilePath , Ġblock ) Ċ fun Ġuse New Bean IO Writer Pre Kotlin 1 dot 1 ( stream Name : ĠString , ĠfilePath : ĠPath , Ġblock : Ġ( IO With Digest . MD Writer ) Ġ-> ĠUnit ) Ġ= ĊĠĠĠĠĠĠĠ ĠBean IO Kit . use New Writer ( stream Name , ĠfilePath , Ġblock ) Ċ Ċ object ĠBean IO Kit Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġstream Factory : ĠStream Factory Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠStream Factory . newInstance (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġload ( Unit :: class . java . getResource AsStream ("/ bean - io - config . xml ")) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġuse NewReader ( stream Name : ĠString , Ġreader : ĠReader , Ġdigest : ĠMessage Digest , Ġblock : Ġ( IO With Digest . MD Reader ) Ġ-> ĠUnit ) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstream Factory . create Reader ( stream Name , Ġreader ). use As Closeable ( digest , Ġblock ) ĊĊĠĠĠ Ġfun Ġuse New Writer ( stream Name : ĠString , Ġwriter : ĠWriter , Ġdigest : ĠMessage Digest , Ġblock : Ġ( IO With Digest . MD Writer ) Ġ-> ĠUnit ) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstream Factory . create Writer ( stream Name , Ġwriter ). use As Closeable ( digest , Ġblock ) ĊĊĠĠĠ Ġfun Ġuse NewReader ( stream Name : ĠString , ĠfilePath : ĠPath , Ġblock : Ġ( IO With Digest . MD Reader ) Ġ-> ĠUnit ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmd Stream Ġ= ĠfilePath . to File (). digest InputStream () ĊĠĠĠĠĠĠĠ Ġmd Stream . buffered Reader (). use Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuse NewReader ( stream Name , Ġit , Ġmd Stream . message Digest , Ġblock ) ĊĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġuse New Writer ( stream Name : ĠString , ĠfilePath : ĠPath , Ġblock : Ġ( IO With Digest . MD Writer ) Ġ-> ĠUnit ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmd Stream Ġ= ĠfilePath . to File (). digest OutputStream () ĊĠĠĠĠĠĠĠ Ġmd Stream . buffered Writer (). use Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuse New Writer ( stream Name , Ġit , Ġmd Stream . message Digest , Ġblock ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ } Ċ Ċ private Ġclass ĠClose able Bean Reader With Digest ( b : ĠBean Reader , Ġmd : ĠMessage Digest ) ĊĠĠĠ Ġ: ĠBean Reader Ġby Ġb , ĠIO With Digest . MD Reader ( md ) Ċ private Ġclass ĠClose able Bean Writer With Digest ( b : ĠBean Writer , Ġmd : ĠMessage Digest ) ĊĠĠĠ Ġ: ĠBean Writer Ġby Ġb , ĠIO With Digest . MD Writer ( md ) Ċ Ċ private Ġinline Ġfun ĠBean Reader . use As Closeable ( digest : ĠMessage Digest , Ġblock : Ġ( IO With Digest . MD Reader ) Ġ-> ĠUnit ) Ġ= ĊĠĠĠĠĠĠĠ ĠClose able Bean Reader With Digest ( this , Ġdigest ). use ( block ) Ċ private Ġinline Ġfun ĠBean Writer . use As Closeable ( digest : ĠMessage Digest , Ġblock : Ġ( IO With Digest . MD Writer ) Ġ-> ĠUnit ) Ġ= ĊĠĠĠĠĠĠĠ ĠClose able Bean Writer With Digest ( this , Ġdigest ). use ( block ) Ċ