public void read ( TagValue tv , String filename ) { originalValue = tv . getValue ( ) ; File file = new File ( filename ) ; IIMReader reader = null ; SubIIMInputStream subStream = null ; try { int offset = tv . getReadOffset ( ) ; int length = tv . getReadlength ( ) ; subStream = new SubIIMInputStream ( new FileIIMInputStream ( file ) , offset , length ) ; reader = new IIMReader ( subStream , new IIMDataSetInfoFactory ( ) ) ; IIMFile iimFileReader = new IIMFile ( ) ; iimFileReader . readFrom ( reader , 0 ) ; List < DataSet > lds = new ArrayList < DataSet > ( ) ; for ( DataSet ds : iimFileReader . getDataSets ( ) ) { ds . getData ( ) ; lds . add ( ds ) ; } iimFile = new IIMFile ( ) ; iimFile . setDataSets ( lds ) ; tv . reset ( ) ; tv . add ( this ) ; reader . close ( ) ; subStream . close ( ) ; } catch ( IOException e ) { //e.printStackTrace(); try { reader . close ( ) ; subStream . close ( ) ; } catch ( Exception ex ) { } } catch ( InvalidDataSetException e ) { //e.printStackTrace(); try { reader . close ( ) ; subStream . close ( ) ; } catch ( Exception ex ) { } } }
Reads the IPTC .