public static DesignDocument fromFile ( File file ) throws FileNotFoundException { assertNotEmpty ( file , "Design js file" ) ; DesignDocument designDocument ; Gson gson = new Gson ( ) ; InputStreamReader reader = null ; try { reader = new InputStreamReader ( new FileInputStream ( file ) , "UTF-8" ) ; //Deserialize JS file contents into DesignDocument object designDocument = gson . fromJson ( reader , DesignDocument . class ) ; return designDocument ; } catch ( UnsupportedEncodingException e ) { //UTF-8 should be supported on all JVMs throw new RuntimeException ( e ) ; } finally { IOUtils . closeQuietly ( reader ) ; } }
Deserialize a javascript design document file to a DesignDocument object .