29package com.jogamp.common.util;
31import com.jogamp.common.os.AndroidVersion;
32import com.jogamp.common.os.Platform;
34import java.io.IOException;
35import java.io.InputStream;
37import java.util.Enumeration;
38import java.util.Iterator;
40import java.util.jar.Attributes;
41import java.util.jar.Manifest;
43import jogamp.common.os.PlatformPropsImpl;
47 public static final String
SEPERATOR =
"-----------------------------------------------------------------------------------------------------";
54 sb =
new StringBuilder();
62 sb.append(Runtime.getRuntime().availableProcessors()).append(
" cores, ").append(
"littleEndian ").append(PlatformPropsImpl.LITTLE_ENDIAN);
76 if( PlatformPropsImpl.JAVA_21 ) {
77 sb.append(
", Java21");
78 }
else if( PlatformPropsImpl.JAVA_17 ) {
79 sb.append(
", Java17");
80 }
else if( PlatformPropsImpl.JAVA_9 ) {
82 }
else if( PlatformPropsImpl.JAVA_6 ) {
84 }
else if( PlatformPropsImpl.JAVA_SE ) {
85 sb.append(
", JavaSE");
87 sb.append(
", dynamicLib: ").append(PlatformPropsImpl.useDynamicLibraries);
109 public static Manifest
getManifest(
final ClassLoader cl,
final String extension) {
110 return getManifest(cl,
new String[] { extension } );
121 public static Manifest
getManifest(
final ClassLoader cl,
final String[] extensions) {
122 final Manifest[] extManifests =
new Manifest[extensions.length];
124 final Enumeration<URL> resources = cl.getResources(
"META-INF/MANIFEST.MF");
125 while (resources.hasMoreElements()) {
126 final InputStream is = resources.nextElement().openStream();
127 final Manifest manifest;
129 manifest =
new Manifest(is);
133 final Attributes attributes = manifest.getMainAttributes();
134 if(attributes !=
null) {
135 for(
int i=0; i < extensions.length &&
null == extManifests[i]; i++) {
136 final String extension = extensions[i];
137 if( extension.equals( attributes.getValue( Attributes.Name.EXTENSION_NAME ) ) ) {
141 extManifests[i] = manifest;
146 }
catch (
final IOException ex) {
147 throw new RuntimeException(
"Unable to read manifest.", ex);
149 for(
int i=1; i<extManifests.length; i++) {
150 if(
null != extManifests[i] ) {
151 return extManifests[i];
163 sb =
new StringBuilder();
166 final Attributes attr = mf.getMainAttributes();
167 final Set<Object> keys = attr.keySet();
168 for(
final Iterator<Object> iter=keys.iterator(); iter.hasNext(); ) {
169 final Attributes.Name key = (Attributes.Name) iter.next();
170 final String val = attr.getValue(key);
static final int SDK_INT
SDK Version number, key to VERSION_CODES.
static final String CODENAME
Development codename, or the string "REL" for official release.
static final String SDK_NAME
SDK Version string.
static final String RELEASE
official build version string
StringBuilder toString(StringBuilder sb)
static void close(final Closeable stream, final boolean throwRuntimeException)
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 final String SEPERATOR
static Manifest getManifest(final ClassLoader cl, final String extension)
Returns the manifest of the jar which contains the specified extension.
static String getPlatformInfo()
Prints platform info.
static StringBuilder getFullManifestInfo(final Manifest mf, StringBuilder sb)