Menu

Sample5

Abstract

This sample show us how to read properties from a MANIFEST.MF file using the ManifestPropertyFinder.


Este ejemplo nos muestra cómo leer propiedades desde un archivo MANIFEST.MF utilizando el ManifestPropertyFinder.

MANIFEST.MF

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: SCF Builder
Created-On: 2012-08-13 [19:47:27]
Commons-Version: 1.0

Sample.java

package ar.com.scf.sample05;

import java.io.File;

import ar.com.scf.IPropertyFinder;
import ar.com.scf.impl.ManifestPropertyFinder;
import ar.com.scf.impl.PropertyReplacer;

public class Sample {

  public static void main(String[] args) {
    IPropertyFinder finder = new ManifestPropertyFinder(new File("MANIFEST.MF"));
    PropertyReplacer replacer = new PropertyReplacer(finder);

    System.out.println(replacer.expand("Builder: ${Ant-Version}"));

  }

}

output

Builder: Apache Ant 1.8.2

Related

Wiki: Samples

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.