Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of java.io.File

    private ArtifactObject createArtifact(String name, Attributes attrs, InputStream is) throws Exception {

ArtifactObject artifact = findArtifact(name, attrs);



if (artifact != null) {

return artifact;

}

else if (Boolean.parseBoolean(attrs.getValue(DEPLOYMENT_PACKAGE_MISSING))) {

m_log.log(LogService.LOG_WARNING, String.format("Unable to create artifact '%s' as it is missing...", name));

return null;

}

else {

m_log.log(LogService.LOG_INFO, String.format("Creating artifact '%s'...", name));



File file = storeArtifactContents(name, is);

try {

return m_workspace.createArtifact(file.toURI().toURL().toExternalForm(), true /* upload */);

}

finally {

file.delete();

}

}

}


   Like      Feedback      java.io.File



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner