/** * @deprecated Use {@link #make512Safe(StringBuffer, String)} instead * @since 2.9 */ @Deprecated public static String make512Safe(StringBuffer lines) { return make512Safe(lines, LINEBREAK); }
public void myWrite(DataOutputStream out) throws IOException { Iterator<Map.Entry<Object, Object>> it = entrySet().iterator(); while (it.hasNext()) { Map.Entry<Object, Object> e = it.next(); String value = (String) e.getValue(); if (Strings.isEmpty(value)) { StringBuffer buffer = new StringBuffer(((Name) e.getKey()).toString()); buffer.append(": "); byte[] vb = value.trim().getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); buffer.append(value); if (it.hasNext()) buffer.append(lineDelimiter); out.writeBytes(make512Safe(buffer, lineDelimiter)); } } out.writeBytes(lineDelimiter); } }
@Override public void write(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); // Write out the main attributes for the manifest getMainAttributes().myWriteMain(dos); // Now write out the pre-entry attributes Iterator<Map.Entry<String, Attributes>> it = getEntries().entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Attributes> e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); String value = e.getKey(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append(lineDelimiter); dos.writeBytes(make512Safe(buffer, lineDelimiter)); ((OrderAwareAttributes) e.getValue()).myWrite(dos); } dos.flush(); }
@SuppressWarnings("deprecation") public void myWrite(DataOutputStream out) throws IOException { Iterator<Map.Entry<Object, Object>> it = entrySet().iterator(); while (it.hasNext()) { Map.Entry<Object, Object> e = it.next(); String value = (String) e.getValue(); if (Strings.isEmpty(value)) { StringBuffer buffer = new StringBuffer(((Name) e.getKey()).toString()); buffer.append(": "); byte[] vb = value.trim().getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); buffer.append(value); if (it.hasNext()) buffer.append(LINEBREAK); out.writeBytes(make512Safe(buffer)); } } out.writeBytes(LINEBREAK); } }
@SuppressWarnings("deprecation") @Override public void write(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); // Write out the main attributes for the manifest ((OrderAwareAttributes) getMainAttributes()).myWriteMain(dos); // Now write out the pre-entry attributes Iterator<Map.Entry<String, Attributes>> it = getEntries().entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Attributes> e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); String value = e.getKey(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append("\r\n"); dos.writeBytes(make512Safe(buffer)); ((OrderAwareAttributes) e.getValue()).myWrite(dos); } dos.flush(); }
if (it.hasNext()) buffer.append(lineDelimiter); out.writeBytes(make512Safe(buffer, lineDelimiter));
if (it.hasNext()) buffer.append(LINEBREAK); out.writeBytes(make512Safe(buffer));