src/java.base/share/classes/java/util/jar/Attributes.java
changeset 49111 1b33025ae610
parent 48936 13a3013ae0cb
child 49850 e286fa159ff1
equal deleted inserted replaced
49110:a7af40c779d8 49111:1b33025ae610
    38 
    38 
    39 /**
    39 /**
    40  * The Attributes class maps Manifest attribute names to associated string
    40  * The Attributes class maps Manifest attribute names to associated string
    41  * values. Valid attribute names are case-insensitive, are restricted to
    41  * values. Valid attribute names are case-insensitive, are restricted to
    42  * the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70
    42  * the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70
    43  * characters in length. Attribute values can contain any characters and
    43  * characters in length. There must be a colon and a SPACE after the name;
       
    44  * the combined length will not exceed 72 characters.
       
    45  * Attribute values can contain any characters and
    44  * will be UTF8-encoded when written to the output stream.  See the
    46  * will be UTF8-encoded when written to the output stream.  See the
    45  * <a href="{@docRoot}/../specs/jar/jar.html">JAR File Specification</a>
    47  * <a href="{@docRoot}/../specs/jar/jar.html">JAR File Specification</a>
    46  * for more information about valid attribute names and values.
    48  * for more information about valid attribute names and values.
    47  *
    49  *
    48  * <p>This map and its views have a predictable iteration order, namely the
    50  * <p>This map and its views have a predictable iteration order, namely the
   308                  byte[] vb = value.getBytes("UTF8");
   310                  byte[] vb = value.getBytes("UTF8");
   309                  value = new String(vb, 0, 0, vb.length);
   311                  value = new String(vb, 0, 0, vb.length);
   310              }
   312              }
   311              buffer.append(value);
   313              buffer.append(value);
   312 
   314 
       
   315              Manifest.make72Safe(buffer);
   313              buffer.append("\r\n");
   316              buffer.append("\r\n");
   314              Manifest.make72Safe(buffer);
       
   315              os.writeBytes(buffer.toString());
   317              os.writeBytes(buffer.toString());
   316          }
   318          }
   317         os.writeBytes("\r\n");
   319         os.writeBytes("\r\n");
   318     }
   320     }
   319 
   321 
   353                     byte[] vb = value.getBytes("UTF8");
   355                     byte[] vb = value.getBytes("UTF8");
   354                     value = new String(vb, 0, 0, vb.length);
   356                     value = new String(vb, 0, 0, vb.length);
   355                 }
   357                 }
   356                 buffer.append(value);
   358                 buffer.append(value);
   357 
   359 
       
   360                 Manifest.make72Safe(buffer);
   358                 buffer.append("\r\n");
   361                 buffer.append("\r\n");
   359                 Manifest.make72Safe(buffer);
       
   360                 out.writeBytes(buffer.toString());
   362                 out.writeBytes(buffer.toString());
   361             }
   363             }
   362         }
   364         }
   363         out.writeBytes("\r\n");
   365         out.writeBytes("\r\n");
   364     }
   366     }