// get the version number, which needs to be part of the filename...
int version = Integer.valueOf(sigFile.getAttribute("Version"));
boolean deprecated = Boolean
.valueOf(sigFile.getAttribute("Deprecated"));
SignatureFileInfo sigInfo = new SignatureFileInfo(version, deprecated, SignatureType.BINARY);
String fileName = String.format(filenamePattern, version);
BufferedWriter writer = null;
try {
File outputFile = new File(targetDir, fileName);
outputFile.createNewFile();
writer = new BufferedWriter(new FileWriter(outputFile));
XMLSerializer serializer = new XMLSerializer(writer,
new OutputFormat(Method.XML, "UTF-8", true));
serializer.serialize(sigFile);
sigInfo.setFile(outputFile);
} catch (IOException e) {
throw new SignatureServiceException(e);
} finally {
try {
writer.close();