private void writeEntries(BufferedWriter writer) throws IOException { for (Entry<String, Attributes> entry : entries.entrySet()) { writer.write(newline); writer.append("Name: ").append(entry.getKey()).append(newline); for (Entry<String, String> child : entry.getValue().entrySet()) { String key = child.getKey(); String value = child.getValue(); if (value.isEmpty()) continue; writer.append(make512Safe(new StringBuffer(key + ": " + separateCommas(value)), newline)); } } }
private void writeHeader(BufferedWriter writer) throws IOException { if (version == null) return; String manifestVersion = mainAttributes.get(MANIFEST_VERSION); if (manifestVersion != null) writer.append(MANIFEST_VERSION).append(": ").append(manifestVersion).append(newline); String signatureVersion = mainAttributes.get(SIGNATURE_VERSION); if (signatureVersion != null) writer.append(SIGNATURE_VERSION).append(": ").append(signatureVersion).append(newline); for (Entry<String, String> entry : mainAttributes.entrySet()) { String key = entry.getKey(); if (key.equals(MANIFEST_VERSION) || key.equals(SIGNATURE_VERSION)) continue; String value = entry.getValue(); writer.append(make512Safe(new StringBuffer(key + ": " + separateCommas(value)), newline)); } }
@Override public void writeTo(final IFileSystemAccess2 fileSystemAccess) { try { if ((fileSystemAccess != null)) { CharSequence _content = this.getContent(); StringBuffer _stringBuffer = new StringBuffer(_content); final String contentToWrite = MergeableManifest2.make512Safe(_stringBuffer, this.lineDelimiter); byte[] _bytes = contentToWrite.getBytes("UTF-8"); ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_bytes); final MergeableManifest2 mergeableManifest = new MergeableManifest2(_byteArrayInputStream); mergeableManifest.setLineDelimiter(this.lineDelimiter); ByteArrayOutputStream bout = new ByteArrayOutputStream(); mergeableManifest.write(bout); byte[] _byteArray = bout.toByteArray(); ByteArrayInputStream _byteArrayInputStream_1 = new ByteArrayInputStream(_byteArray); fileSystemAccess.generateFile(this.getPath(), _byteArrayInputStream_1); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }