29import java.io.IOException;
30import java.io.InputStream;
32import java.util.Enumeration;
33import java.util.Iterator;
35import java.util.jar.Attributes;
36import java.util.jar.Manifest;
38import org.jau.io.IOUtil;
39import org.jau.sys.AndroidVersion;
40import org.jau.sys.PlatformProps;
41import org.jau.sys.RuntimeProps;
42import org.jau.sys.PlatformTypes;
46 public static final String
SEPERATOR =
"-----------------------------------------------------------------------------------------------------";
53 sb =
new StringBuilder();
61 sb.append(Runtime.getRuntime().availableProcessors()).append(
" cores, ").append(
"littleEndian ").append(
PlatformProps.
LITTLE_ENDIAN);
80 sb.append(
", Java21");
82 sb.append(
", Java17");
107 public static Manifest
getManifest(
final ClassLoader cl,
final String extension) {
108 return getManifest(cl,
new String[] { extension } );
119 public static Manifest
getManifest(
final ClassLoader cl,
final String[] extensions) {
120 final Manifest[] extManifests =
new Manifest[extensions.length];
122 final Enumeration<URL> resources = cl.getResources(
"META-INF/MANIFEST.MF");
123 while (resources.hasMoreElements()) {
124 final InputStream is = resources.nextElement().openStream();
125 final Manifest manifest;
127 manifest =
new Manifest(is);
131 final Attributes attributes = manifest.getMainAttributes();
132 if(attributes !=
null) {
133 for(
int i=0; i < extensions.length &&
null == extManifests[i]; i++) {
134 final String extension = extensions[i];
135 if( extension.equals( attributes.getValue( Attributes.Name.EXTENSION_NAME ) ) ) {
139 extManifests[i] = manifest;
144 }
catch (
final IOException ex) {
145 throw new RuntimeException(
"Unable to read manifest.", ex);
147 for(
int i=1; i<extManifests.length; i++) {
148 if(
null != extManifests[i] ) {
149 return extManifests[i];
161 sb =
new StringBuilder();
164 final Attributes attr = mf.getMainAttributes();
165 final Set<Object> keys = attr.keySet();
166 for(
final Iterator<Object> iter=keys.iterator(); iter.hasNext(); ) {
167 final Attributes.Name key = (Attributes.Name) iter.next();
168 final String val = attr.getValue(key);
static void close(final Closeable stream, final boolean throwRuntimeException)
static final int SDK_INT
SDK Version number, key to VERSION_CODES.
static final String SDK_NAME
SDK Version string.
static final String RELEASE
official build version string
static final String CODENAME
Development codename, or the string "REL" for official release.
StringBuilder toString(StringBuilder sb)
Runtime platform properties derived from PlatformProps and runtime query.
static final MachineDataInfo MACH_DESC_RT
Runtime determined MachineDataInfo, null if not available (i.e.
static StringBuilder getPlatformInfo(StringBuilder sb)
Appends environment information like OS, JVM and CPU architecture properties to the StringBuilder.
static Manifest getManifest(final ClassLoader cl, final String[] extensions)
Returns the manifest of the jar which contains one of the specified extensions.
static String getPlatformInfo()
Prints platform info.
static final String SEPERATOR
static StringBuilder getFullManifestInfo(final Manifest mf, StringBuilder sb)
static Manifest getManifest(final ClassLoader cl, final String extension)
Returns the manifest of the jar which contains the specified extension.