Java 8 Attributes.Name - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Attributes.Name class.

This code example shows how to use the following methods:
    abstract void includeAttribute(Name name, String attribute);
 
    abstract String findAttribute(Name name);
 
    void includeAttribute(String name, String value) {
        includeAttribute(new Name(name), value);
    } 
 
    @Override 
    public T version(String version) {
        includeAttribute(Name.MANIFEST_VERSION, version);
        return getDescriptor(); 
    } 
 
    @Override 
    public T signatureVersion(String version) {
        includeAttribute(Name.SIGNATURE_VERSION, version);
        return getDescriptor(); 
    } 
 
6
CodeRank
This code example shows how to use the following methods:toString
    private void includeAttributeWithPrefix(Name name, String value) {
        super.attribute(addPrefix(name), value);
    } 
 
    private String addPrefix(Name extensionName) {
        return appletName + "-" + extensionName.toString();
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:toString
    private String appletAttribute(String appletName, Name name) {
        return appletName + "-" + name;
    } 
 
    private void assertContainsAttribute(Descriptor manifest, Name name, String value) {
        assertContainsAttribute(manifest, name.toString(), value);
    } 
 
    private void assertContainsAttribute(Descriptor manifest, String name, String value) {
        String expected = name + ": " + value;
        String actual = manifest.exportAsString();
        assertTrue("Value not found:<" + expected + " >", actual.contains(expected));
    } 
 
    private void assertNotContainsAttribute(Descriptor manifest, Name name, String value) {
        assertNotContainsAttribute(manifest, name.toString(), value);
    } 
 
    private void assertNotContainsAttribute(Descriptor manifest, String name, String value) {
        String expected = name + ": " + value;
5
CodeRank
This code example shows how to use the following methods:toString
            final String value = attr.getValue(attrName);
            return value;
        } 
        catch (IOException ioe)
        { 
            throw new FileSystemException(attrName.toString(), ioe);
        } 
    } 
 
    Name lookupName(String attrName)
    { 
        if (Name.CLASS_PATH.toString().equals(attrName))
        { 
            return Name.CLASS_PATH;
        } 
        else if (Name.CONTENT_TYPE.toString().equals(attrName))
        { 
            return Name.CONTENT_TYPE;
        } 
        else if (Name.EXTENSION_INSTALLATION.toString().equals(attrName))
4
CodeRank
This code example shows how to use the following methods:toString
   * jar Manifest files out in the wild. 
   */ 
  private static void readVersionInfo(Attributes attr, BufferedReader br)
      throws IOException 
  { 
    String version_header = Name.MANIFEST_VERSION.toString();
    try 
      { 
        String value = expectHeader(version_header, br);
        attr.putValue(MANIFEST_VERSION, value);
      } 
    catch (IOException ioe)
      { 
        throw new JarException("Manifest should start with a " + version_header
                               + ": " + ioe.getMessage());
      } 
  } 
 
  private static String expectHeader(String header, BufferedReader br)
      throws IOException 
4
CodeRank
This code example shows how to use the following methods:toString
 
        return !result.isEmpty() ? new CompoundArtifactDelta("different", result) : null;
    } 
 
    protected void addDelta(TreeMap<String, ArtifactDelta> result, Name key, String message) {
        result.put(key.toString(), new SimpleArtifactDelta(message));
    } 
 
    protected Set<Name> getNames(Attributes attributes) {
        Set<Name> result = new LinkedHashSet<Name>();
        for (Object key : attributes.keySet()) {
            Name name = (Name) key;
            if (!IGNORED_KEYS.contains(name)) {
                result.add(name);
            } 
        } 
        return result;
    } 
} 
4
CodeRank
This code example shows how to use the following methods:toString
   * jar Manifest files out in the wild. 
   */ 
  private static void readVersionInfo(Attributes attr, BufferedReader br)
      throws IOException 
  { 
    String version_header = Name.MANIFEST_VERSION.toString();
    try 
      { 
        String value = expectHeader(version_header, br);
        attr.putValue(MANIFEST_VERSION, value);
      } 
    catch (IOException ioe)
      { 
        throw new JarException("Manifest should start with a " + version_header
                               + ": " + ioe.getMessage());
      } 
  } 
 
  private static String expectHeader(String header, BufferedReader br)
      throws IOException 
3
CodeRank
This code example shows how to use the following methods:
 
  /** Platform-independent line-ending. */ 
  public static final byte[] CRLF = new byte[] { 0x0D, 0x0A };
  private static final String DEFAULT_MF_VERSION = "1.0";
  private static final String DEFAULT_SF_VERSION = "1.0";
  private static final Name CREATED_BY = new Name("Created-By");
  private static final String CREATOR = SystemProperties.getProperty("java.version")
                                        + " (" 
                                        + SystemProperties.getProperty("java.vendor") 
                                        + ")"; 
 
  // default 0-arguments constructor 
 
  // Methods for reading Manifest files from InputStream ---------------------- 
 
  public static void 
  readMFManifest(Attributes attr, Map entries, InputStream in)
      throws IOExceptionBufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
4
CodeRank
This code example shows how to use the following methods:toString
     * @param defaultValue the default if the attribute does not exist in the manifest  
     * 
     * @return the attribute value or the default if it doesn't exist or cannot be retrieved 
     */ 
    public String getAttributeValue(Name attributeName, String defaultValue) {
        return getAttributeValue(attributeName.toString(), defaultValue);
    } 
 
    /** 
     * Returns an attribute value as found in the manifest. 
     *  
     * @param attributeName the attribute name 
     * @param defaultValue the default if the attribute does not exist in the manifest  
     * 
     * @return the attribute value or the default if it doesn't exist or cannot be retrieved 
     */ 
    public String getAttributeValue(String attributeName, String defaultValue) {
        String result = defaultValue;
 
        if (null != this.mainAttributes) {
3
CodeRank
This code example shows how to use the following methods:
 
        public static final Name BUNDLE_VERSION = new Name("Bundle-Version");
 
        public static final Name BUNDLE_ACTIVATOR = new Name("Bundle-Activator");
 
        public static final Name BUNDLE_VENDOR = new Name("Bundle-Vendor");
 
        public static final Name REQUIRE_BUNDLE = new Name("Require-Bundle");
 
        public static final Name IMPORT_PACKAGE = new Name("Import-Package");
 
        public static final Name BUNDLE_CLASSPATH = new Name("Bundle-ClassPath");
 
        /** unmodifiable list of all valid OSGIBundle Name's */ 
        public static final List NAMES;
        static { 
            ArrayList names = new ArrayList();
            names.add(BUNDLE_NAME);
            names.add(BUNDLE_SYMBOLIC_NAME);
            names.add(BUNDLE_VERSION);
4
CodeRank
See Code Examples for Java 8 Attributes.Name Methods: