public static Manifest s_create( String strSpecVend, String strSpecVers, String strImplVend, String strImplVers, String strImplVendId) { // create the manifest object Manifest man = S_Manifest.s_create(); Attributes attAttributes = man.getMainAttributes(); if (strSpecVend != null) attAttributes.putValue(S_Manifest.f_s_strKeySpecVend, strSpecVend); if (strSpecVers != null) attAttributes.putValue(S_Manifest.f_s_strKeySpecVers, strSpecVers); if (strImplVend != null) attAttributes.putValue(S_Manifest.f_s_strKeyImplVend, strImplVend); if (strImplVers != null) attAttributes.putValue(S_Manifest.f_s_strKeyImplVers, strImplVers); if (strImplVendId != null) attAttributes.putValue(S_Manifest.f_s_strKeyImplVendId, strImplVendId); return man; }
/* transform manifest in an array of byte if any code error, exit else if any error, show dialog, then return nil */ public static byte[] s_toByteArray(Manifest man, Frame frmOwner) { String strMethod = _f_s_strClass + "s_toByteArray(...)"; if (man == null) { MySystem.s_printOutExit(strMethod, "nil man"); } ByteArrayOutputStream baoBuffer = new ByteArrayOutputStream(); try { man.write(baoBuffer); baoBuffer.flush(); baoBuffer.close(); } catch (IOException excIO) { excIO.printStackTrace(); MySystem.s_printOutExit(strMethod, "excIO caught"); String strBody = "Got IO exception"; OPAbstract.s_showDialogError(frmOwner, strBody); return null; } return baoBuffer.toByteArray(); }
private static Hashtable<String, String> getManifestAttributes(Manifest manifest) { Hashtable<String, String> h = new Hashtable<String, String>(); try { Attributes attrs = manifest.getMainAttributes(); Iterator it = attrs.keySet().iterator(); while (it.hasNext()) { String key = it.next().toString(); h.put(key, attrs.getValue(key)); } } catch (Exception ignore) { } return h; }
public static void s_fill(Manifest man) { String strMethod = _f_s_strClass + "s_fill(man)"; if (man == null) { MySystem.s_printOutExit(strMethod, "nil man"); } Attributes attAttributes = man.getMainAttributes(); attAttributes.putValue( S_Manifest._f_s_strsDefaultEntryManifVersion[0], S_Manifest._f_s_strsDefaultEntryManifVersion[1]); attAttributes.putValue( S_Manifest._f_s_strsDefaultEntryManifCreator[0], S_Manifest._f_s_strsDefaultEntryManifCreator[1]); }