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);
        }
    }
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" ) ; designDocument = gson . fromJson ( reader , DesignDocument . class ) ; return designDocument ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } finally { IOUtils . closeQuietly ( reader ) ; } }
Deserialize a javascript design document file to a DesignDocument object.

@param file the design document javascript file (UTF-8 encoded)
@return {@link DesignDocument}
@throws FileNotFoundException if the file does not exist or cannot be read