Java API to create scripted templates

We can use the Java API to create indexed templates using the

client.admin().indices().preparePutTemplate("template1")
                    .setSource("...") //some source 
                    .execute().actionGet();

Is is possible to use the Java API to create or mock creating file (scripts) templates stored in the config/scripts folder for testing purposes?