public Group makeRelativeGroup ( NetcdfFile ncf , String path , boolean ignorelast ) { path = path . trim ( ) ; path = path . replace ( "//" , "/" ) ; boolean isabsolute = ( path . charAt ( 0 ) == ' ' ) ; if ( isabsolute ) path = path . substring ( 1 ) ; // iteratively create path String pieces [ ] = path . split ( "/" ) ; if ( ignorelast ) pieces [ pieces . length - 1 ] = null ; Group current = ( isabsolute ? ncfile . getRootGroup ( ) : this ) ; for ( String name : pieces ) { if ( name == null ) continue ; String clearname = NetcdfFile . makeNameUnescaped ( name ) ; //?? Group next = current . findGroup ( clearname ) ; if ( next == null ) { next = new Group ( ncf , current , clearname ) ; current . addGroup ( next ) ; } current = next ; } return current ; }
Create groups to ensure path is defined