示例#1
0
        /*
         * Adapter implementation method; do not call.
         * Adapt a SAX1 end element event.
         *
         * @param qName The qualified (prefixed) name.
         * @exception SAXException The client may raise a
         *            processing exception.
         * @see org.xml.sax.DocumentHandler#endElement
         */
        public void endElement(String qName)
        //throws SAXException
        {
            // If we're not doing Namespace
            // processing, dispatch this quickly.
            if (!namespaces)
            {
                if (contentHandler != null)
                {
                    contentHandler.endElement("", "", qName.intern());
                }
                return;
            }

            // Split the name.
            String[] names = processName(qName, false, false);
            if (contentHandler != null)
            {
                contentHandler.endElement(names[0], names[1], names[2]);
                java.util.Enumeration <Object> prefixes = nsSupport.getDeclaredPrefixes(); //FIXME use Enumeration<String>
                while (prefixes.hasMoreElements())
                {
                    String prefix = (String)prefixes.nextElement();
                    contentHandler.endPrefixMapping(prefix);
                }
            }
            nsSupport.popContext();
        }
示例#2
0
文件: vfs.cs 项目: tianlian0/ikvm
        private static void Initialize()
        {
            VfsDirectory root = new VfsDirectory();

            root.AddDirectory("lib").AddDirectory("security").Add("cacerts", new VfsCacertsEntry());
            VfsDirectory bin = new VfsDirectory();

            root.Add("bin", bin);
            root.Add("assembly", new VfsAssembliesDirectory());
            AddDummyLibrary(bin, "zip");
            AddDummyLibrary(bin, "awt");
            AddDummyLibrary(bin, "rmi");
            AddDummyLibrary(bin, "w2k_lsa_auth");
            AddDummyLibrary(bin, "jaas_nt");
            AddDummyLibrary(bin, "jaas_unix");
            AddDummyLibrary(bin, "net");
            AddDummyLibrary(bin, "splashscreen");
            AddDummyLibrary(bin, "osx");
            AddDummyLibrary(bin, "management");
            bin.Add("java", new VfsJavaExe());
            bin.Add("javaw", new VfsJavaExe());
            bin.Add("java.exe", new VfsJavaExe());
            bin.Add("javaw.exe", new VfsJavaExe());

            // this is a weird loop back, the vfs.zip resource is loaded from vfs,
            // because that's the easiest way to construct a ZipFile from a Stream.
            java.util.zip.ZipFile zf = new java.util.zip.ZipFile(RootPath + "vfs.zip");
            java.util.Enumeration e  = zf.entries();
            while (e.hasMoreElements())
            {
                AddZipEntry(zf, root, (java.util.zip.ZipEntry)e.nextElement());
            }

            Interlocked.CompareExchange(ref VirtualFileSystem.root, root, null);
        }
示例#3
0
        void LoadWwwForm()
        {
            HttpServletRequest servletReq = context.ServletRequest;

            if (servletReq == null)
            {
                NameValueCollection requestParameters = context.RequestParameters;
                if (requestParameters != null)
                {
                    form.Add(requestParameters);
                }
                else
                {
                    RawLoadWwwForm();
                }
                return;
            }

            servletReq.setCharacterEncoding(ContentEncoding.WebName);

            for (java.util.Enumeration e = servletReq.getParameterNames(); e.hasMoreElements();)
            {
                string    key     = (string)e.nextElement();
                string [] qvalue  = QueryString.GetValues(key);
                string [] qfvalue = servletReq.getParameterValues(key);

                for (int i = (qvalue != null) ? qvalue.Length : 0; i < qfvalue.Length; i++)
                {
                    form.Add(key, qfvalue [i]);
                }
            }
        }
 /**
  * Constructs a new <code>EnumerationIterator</code> that will remove
  * elements from the specified collection.
  *
  * @param enumeration  the enumeration to use
  * @param collection  the collection to remove elements form
  */
 public EnumerationIterator(java.util.Enumeration <Object> enumeration, java.util.Collection <Object> collection)
     : base()
 {
     this.enumeration = enumeration;
     this.collection  = collection;
     this.last        = null;
 }
示例#5
0
        /*
         * Returns a string containing a concise, human-readable description of this
         * {@code PermissionCollection}.
         *
         * @return a printable representation for this {@code PermissionCollection}.
         */
        public override String ToString()
        {
            java.util.ArrayList <String>       elist  = new java.util.ArrayList <String>(100);
            java.util.Enumeration <Permission> elenum = elements();
            String superStr    = base.ToString();
            int    totalLength = superStr.length() + 5;

            if (elenum != null)
            {
                while (elenum.hasMoreElements())
                {
                    String el = elenum.nextElement().toString();
                    totalLength += el.length();
                    elist.add(el);
                }
            }
            int esize = elist.size();

            totalLength += esize * 4;
            java.lang.StringBuilder result = new java.lang.StringBuilder(totalLength).append(superStr)
                                             .append(" ("); //$NON-NLS-1$
            for (int i = 0; i < esize; i++)
            {
                result.append("\n ").append(elist.get(i).toString()); //$NON-NLS-1$
            }
            return(result.append("\n)\n").toString());                //$NON-NLS-1$
        }
示例#6
0
        private bool defaultImplies(ProtectionDomain domain, Permission permission)
        {
            if (domain == null && permission == null)
            {
                throw new java.lang.NullPointerException();
            }
            bool implies = false;

            if (domain != null)
            {
                PermissionCollection total    = getPermissions(domain);
                PermissionCollection inherent = domain.getPermissions();
                if (inherent != null)
                {
                    java.util.Enumeration <Permission> en = inherent.elements();
                    while (en.hasMoreElements())
                    {
                        total.add(en.nextElement());
                    }
                }
                try {
                    implies = total.implies(permission);
                } catch (java.lang.NullPointerException) {
                    // return false instead of throwing the NullPointerException
                    implies = false;
                }
            }
            return(implies);
        }
        public override string [][] GetUnknownRequestHeaders()
        {
            if (unknownHeaders == null)
            {
                ArrayList pairs = new ArrayList();
                for (java.util.Enumeration he = getHeaderNames(); he.hasMoreElements();)
                {
                    string key   = (string)he.nextElement();
                    int    index = HttpWorkerRequest.GetKnownRequestHeaderIndex(key);
                    if (index != -1)
                    {
                        continue;
                    }
                    pairs.Add(new string [] { key, getHeader(key) });
                }

                if (pairs.Count != 0)
                {
                    unknownHeaders = new string [pairs.Count][];
                    for (int i = 0; i < pairs.Count; i++)
                    {
                        unknownHeaders [i] = (string [])pairs [i];
                    }
                }
            }
            if (unknownHeaders == null)
            {
                unknownHeaders = new string [0][];
            }

            return(unknownHeaders);
        }
示例#8
0
        /**
         * Returns a {@code PermissionCollection} describing what permissions are
         * allowed for the specified {@code ProtectionDomain} (more specifically,
         * its {@code CodeSource}) based on the current security policy.
         * <p />
         * Note that this method is not called for classes which are in the
         * system domain (i.e. system classes). System classes are always
         * given full permissions (i.e. AllPermission). This can not be changed by
         * installing a new policy.
         *
         * @param domain
         *            the {@code ProtectionDomain} to compute the permissions for.
         * @return the permissions that are granted to the specified {@code
         *         CodeSource}.
         */
        public PermissionCollection getPermissions(ProtectionDomain domain)
        {
            Permissions permissions = new Permissions();

            if (domain != null)
            {
                try {
                    PermissionCollection cds = getPermissions(domain
                                                              .getCodeSource());
                    if (cds != Policy.UNSUPPORTED_EMPTY_COLLECTION)
                    {
                        java.util.Enumeration <Permission> elements = cds.elements();
                        while (elements.hasMoreElements())
                        {
                            permissions.add(elements.nextElement());
                        }
                    }
                } catch (java.lang.NullPointerException) {
                    // ignore the exception, just add nothing to the result set
                }

                PermissionCollection pds = domain.getPermissions();
                if (pds != null)
                {
                    java.util.Enumeration <Permission> pdElements = pds.elements();
                    while (pdElements.hasMoreElements())
                    {
                        permissions.add(pdElements.nextElement());
                    }
                }
            }
            return(permissions);
        }
示例#9
0
        /**
         * Closes all streams in this sequence of input stream.
         *
         * @throws IOException
         *             if an error occurs while closing any of the input streams.
         */

        public override void close()
        {        //throws IOException {
            while (inJ != null)
            {
                nextStream();
            }
            e = null;
        }
        // Views
        //-----------------------------------------------------------------------

        /**
         * Gets an iterator that provides an iterator view of the given enumeration.
         *
         * @param enumeration  the enumeration to use
         * @return a new iterator
         */
        public static java.util.Iterator <Object> asIterator(java.util.Enumeration <Object> enumeration)
        {
            if (enumeration == null)
            {
                throw new java.lang.NullPointerException("Enumeration must not be null");
            }
            return(new EnumerationIterator(enumeration));
        }
示例#11
0
        private static IEnumerable ToEnumer(java.util.Enumeration enumeration)
        {
            List <object> list = new List <object>();

            while (enumeration.hasMoreElements())
            {
                list.Add(enumeration.nextElement());
            }
            return(list);
        }
示例#12
0
 /**
  * Constructs a new SequenceInputStream using the elements returned from
  * Enumeration {@code e} as the stream sequence. The instances returned by
  * {@code e.nextElement()} must be of type {@link InputStream}.
  *
  * @param e
  *            the enumeration of {@code InputStreams} to get bytes from.
  * @throws NullPointerException
  *             if any of the elements in {@code e} is {@code null}.
  */
 public SequenceInputStream(java.util.Enumeration<InputStream> e)
 {
     this.e = e;
     if (e.hasMoreElements ()) {
         inJ = e.nextElement ();
         if (inJ == null) {
             throw new java.lang.NullPointerException ();
         }
     }
 }
示例#13
0
 /**
  * Constructs a new {@code SequenceInputStream} using the two streams
  * {@code s1} and {@code s2} as the sequence of streams to read from.
  *
  * @param s1
  *            the first stream to get bytes from.
  * @param s2
  *            the second stream to get bytes from.
  * @throws NullPointerException
  *             if {@code s1} is {@code null}.
  */
 public SequenceInputStream(InputStream s1, InputStream s2)
 {
     if (s1 == null) {
         throw new java.lang.NullPointerException ();
     }
     java.util.Vector<InputStream> inVector = new java.util.Vector<InputStream> (1);
     inVector.addElement (s2);
     e = inVector.elements ();
     inJ = s1;
 }
示例#14
0
        /*
         * Update rows which match a WHERE clause
         */
        private void UpdateStatement(String tableName, java.util.Vector <Object> c, java.util.Vector <Object> v, TinySQLWhere wc)
        //throws TinySQLException
        {
            /*
             *    Create a table object and put it in the Hashtable.
             */
            TinySQLTable jtbl = getTable(tableName);

            java.util.Hashtable <Object, Object> tables = new java.util.Hashtable <Object, Object>();
            tables.put(tableName, jtbl);
            String columnName, columnString, whereStatus;

            /*
             *    Process each row in the table ignoring deleted rows.
             */
            jtbl.GoTop();
            while (jtbl.NextRecord())
            {
                if (!jtbl.isDeleted())
                {
                    java.util.Enumeration <Object> cols = jtbl.column_info.keys();
                    whereStatus = "TRUE";
                    while (cols.hasMoreElements())
                    {
                        /*
                         *             Use the table name for the table alias for updates.
                         */
                        columnName = jtbl.table + "->" + jtbl.table
                                     + "." + (String)cols.nextElement();
                        columnString = jtbl.GetCol(columnName);

                        /*
                         *             Check the status of the where clause for each column value.
                         */
                        if (wc != (TinySQLWhere)null)
                        {
                            whereStatus = wc.evaluate(columnName, columnString);
                        }
                        if (whereStatus.equals("FALSE"))
                        {
                            break;
                        }
                    }
                    if (whereStatus.equals("TRUE"))
                    {
                        jtbl.UpdateCurrentRow(c, v);
                    }
                    if (wc != (TinySQLWhere)null)
                    {
                        wc.clearValues(jtbl.table + "->" + jtbl.tableAlias);
                    }
                }
            }
            jtbl.close();
        }
示例#15
0
        public static void Main(string[] args)
        {
            Properties pps = new Properties();

            if (System.IO.File.Exists(DEFAULT_FILE))
            {
                LoadLeapPropertiesFile();
            }
            else
            {
                p = new ProfileImpl();
            }

            if (args.Length > 0)
            {
                pps = jade.Boot.parseCmdLineArgs(args);

                if (pps != null)
                {
                    java.util.Enumeration en = pps.keys();
                    while (en.hasMoreElements())
                    {
                        string key  = (string)en.nextElement();
                        string prop = pps.getProperty(key);
                        p.setParameter(key, prop);
                    }    //End WHILE block
                }        //End IF block
            }            //End IF block

            /* VERSIONE 3.2 */
            jade.wrapper.AgentContainer mc = null;
            /* VERSIONE 3.1 */
            //jade.wrapper.MainContainer mc = null;

            try
            {
                if (p.getParameter("main", "true").Equals("false"))
                {
                    mc = Runtime.instance().createAgentContainer(p);
                }
                else
                {
                    mc = Runtime.instance().createMainContainer(p);
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine("\n----------- INIZIO ECCEZIONE ------------------");
                Console.WriteLine(exc.Message);
                Console.WriteLine(exc.InnerException);
                Console.WriteLine("\n----------- FINE ECCEZIONE ------------------");
            }
            Console.ReadLine();
        }
示例#16
0
 /*
  * Indicates whether the argument permission is implied by the permissions
  * contained in the receiver.
  *
  * @return boolean <code>true</code> if the argument permission is implied
  *         by the permissions in the receiver, and <code>false</code> if
  *         it is not.
  * @param permission
  *            java.security.Permission the permission to check
  */
 public override bool implies(Permission permission)
 {
     for (java.util.Enumeration <Permission> elementsJ = elements(); elementsJ.hasMoreElements();)
     {
         if (((Permission)elementsJ.nextElement()).implies(permission))
         {
             return(true);
         }
     }
     return(false);
 }
示例#17
0
 /**
  * Constructs a new {@code SequenceInputStream} using the two streams
  * {@code s1} and {@code s2} as the sequence of streams to read from.
  *
  * @param s1
  *            the first stream to get bytes from.
  * @param s2
  *            the second stream to get bytes from.
  * @throws NullPointerException
  *             if {@code s1} is {@code null}.
  */
 public SequenceInputStream(InputStream s1, InputStream s2)
 {
     if (s1 == null)
     {
         throw new java.lang.NullPointerException();
     }
     java.util.Vector <InputStream> inVector = new java.util.Vector <InputStream> (1);
     inVector.addElement(s2);
     e   = inVector.elements();
     inJ = s1;
 }
示例#18
0
        public static void DensityBasedClusterer()
        {
            try
            {
                Instances data = new Instances(new java.io.FileReader("politeness.arff"));

                MakeDensityBasedClusterer clusterer = new MakeDensityBasedClusterer();

                // set further options for EM, if necessary...
                clusterer.setNumClusters(3);
                clusterer.buildClusterer(data);

                ClusterEvaluation eval = new ClusterEvaluation();
                eval.setClusterer(clusterer);
                eval.evaluateClusterer(data);


                /** Print Prior probabilities for each cluster
                 * double[] Priors = clusterer.clusterPriors();
                 *
                 * for(int x=0; x<Priors.Length; x++)
                 *{
                 *   System.Console.WriteLine(Priors[x]);
                 *}
                 **/

                /**Print default capabilities of the clusterer (i.e., of the wrapper clusterer).
                 * Capabilities Capa = clusterer.getCapabilities();
                 * System.Console.WriteLine(Capa);
                 **/

                /**Print the current settings of the clusterer.
                 * String[] Opts = clusterer.getOptions();
                 * for (int x = 0; x < Opts.Length; x++)
                 *{
                 *    System.Console.WriteLine(Opts[x]);
                 *}
                 **/

                //string gInfo = clusterer.globalInfo();
                //System.Console.WriteLine(gInfo);

                java.util.Enumeration enumOpts = clusterer.listOptions();
                System.Console.WriteLine(enumOpts);

                //Print all results for clusterer as in Weka
                //System.Console.WriteLine(eval.clusterResultsToString());
            }

            catch (java.lang.Exception ex)
            {
                ex.printStackTrace();
            }
        }
示例#19
0
 private java.util.Enumeration <Permission> getNextEnumeration()
 {
     while (pcIter.hasNext())
     {
         java.util.Enumeration <Permission> en = ((PermissionCollection)pcIter.next()).elements();
         if (en.hasMoreElements())
         {
             return(en);
         }
     }
     return(null);
 }
示例#20
0
 /**
  * Constructs a new SequenceInputStream using the elements returned from
  * Enumeration {@code e} as the stream sequence. The instances returned by
  * {@code e.nextElement()} must be of type {@link InputStream}.
  *
  * @param e
  *            the enumeration of {@code InputStreams} to get bytes from.
  * @throws NullPointerException
  *             if any of the elements in {@code e} is {@code null}.
  */
 public SequenceInputStream(java.util.Enumeration <InputStream> e)
 {
     this.e = e;
     if (e.hasMoreElements())
     {
         inJ = e.nextElement();
         if (inJ == null)
         {
             throw new java.lang.NullPointerException();
         }
     }
 }
示例#21
0
        /// <summary inherit="yes"/>

        public override JProperties GetOutputProperties()
        {
            JProperties properties = (defaultOutputProperties == null ? new JProperties() : new JProperties(defaultOutputProperties));

            java.util.Enumeration propsEnum = props.keys();
            while (propsEnum.hasMoreElements())
            {
                object obj   = propsEnum.nextElement();
                String value = (String)(props.get((String)obj));
                properties.setProperty((String)obj, value);
            }
            return(properties);
        }
示例#22
0
        public void testMoreElementHashtableKeyEnumerator()
        {
            java.util.Hashtable <String, String> nameWert = new java.util.Hashtable <String, String>();
            nameWert.put("1", "one");
            nameWert.put("2", "one");

            java.util.Enumeration <String> names = nameWert.keys();

            Assert.True(names.hasMoreElements());
            names.nextElement();
            Assert.True(names.hasMoreElements());
            names.nextElement();
            Assert.False(names.hasMoreElements());
        }
示例#23
0
 /*
  * Return anjava.util.Enumeration&lt;Object&gt; of all prefixes for a given URI whose
  * declarations are active in the current context.
  * This includes declarations from parent contexts that have
  * not been overridden.
  *
  * <p/>This method returns prefixes mapped to a specific Namespace
  * URI.  The xml: prefix will be included.  If you want only one
  * prefix that's mapped to the Namespace URI, and you don't care
  * which one you get, use the {@link #getPrefix getPrefix}
  *  method instead.
  *
  * <p/><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
  * in thisjava.util.Enumeration&lt;Object&gt;; to check for the presence of a default
  * Namespace, use the {@link #getURI getURI} method with an
  * argument of "".
  *
  * @param uri The Namespace URI.
  * @return Anjava.util.Enumeration&lt;Object&gt; of prefixes (never empty).
  * @see #getPrefix
  * @see #getDeclaredPrefixes
  * @see #getURI
  */
 public java.util.Enumeration <Object> getPrefixes(String uri)
 {
     java.util.Vector <Object>      prefixes    = new java.util.Vector <Object>();
     java.util.Enumeration <Object> allPrefixes = getPrefixes();
     while (allPrefixes.hasMoreElements())
     {
         String prefix = (String)allPrefixes.nextElement();
         if (uri.equals(getURI(prefix)))
         {
             prefixes.addElement(prefix);
         }
     }
     return(prefixes.elements());
 }
示例#24
0
        /**
         * Walks through all recorded entries and adds the data available
         * from the local file header.
         *
         * <p>Also records the offsets for the data to read from the
         * entries.</p>
         */
        private void resolveLocalFileHeaderData(java.util.Map <ZipArchiveEntry, IAC_NameAndComment> entriesWithoutUTF8Flag)
        //throws IOException
        {
            java.util.Enumeration <ZipArchiveEntry> e = getEntries();
            while (e.hasMoreElements())
            {
                ZipArchiveEntry ze          = e.nextElement();
                IAC_OffsetEntry offsetEntry = entries.get(ze);
                long            offset      = offsetEntry.headerOffset;
                archive.seek(offset + LFH_OFFSET_FOR_FILENAME_LENGTH);
                byte[] b = new byte[SHORT];
                archive.readFully(b);
                int fileNameLen = ZipShort.getValue(b);
                archive.readFully(b);
                int extraFieldLen = ZipShort.getValue(b);
                int lenToSkip     = fileNameLen;
                while (lenToSkip > 0)
                {
                    int skipped = archive.skipBytes(lenToSkip);
                    if (skipped <= 0)
                    {
                        throw new java.lang.RuntimeException("failed to skip file name in"
                                                             + " local file header");
                    }
                    lenToSkip -= skipped;
                }
                byte[] localExtraData = new byte[extraFieldLen];
                archive.readFully(localExtraData);
                ze.setExtra(localExtraData);

                /*dataOffsets.put(ze,
                 *              new Long(offset + LFH_OFFSET_FOR_FILENAME_LENGTH
                 + SHORT + SHORT + fileNameLen + extraFieldLen));
                 */
                offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH
                                         + SHORT + SHORT + fileNameLen + extraFieldLen;

                if (entriesWithoutUTF8Flag.containsKey(ze))
                {
                    String             orig = ze.getName();
                    IAC_NameAndComment nc   = (IAC_NameAndComment)entriesWithoutUTF8Flag.get(ze);
                    ZipUtil.setNameAndCommentFromExtraFields(ze, nc.name, nc.comment);
                    if (!orig.equals(ze.getName()))
                    {
                        nameMap.remove(orig);
                        nameMap.put(ze.getName(), ze);
                    }
                }
            }
        }
示例#25
0
            /**
             * Returns next element.
             */
            public Permission nextElement()
            {
                if (current != null)
                {
                    //assert current.hasMoreElements();
                    Permission next = current.nextElement();
                    if (!current.hasMoreElements())
                    {
                        current = getNextEnumeration();
                    }

                    return(next);
                }
                throw new java.util.NoSuchElementException("no more elements"); //$NON-NLS-1$
            }
示例#26
0
        public string[] ListClassifications()
        {
            List <string> attrs = new List <string>();

            for (int i = 0; i < structure.numAttributes(); ++i)
            {
                if (!structure.attribute(i).isNominal())
                {
                    continue;
                }
                java.util.Enumeration en = structure.attribute(i).enumerateValues();
                while (en.hasMoreElements())
                {
                    attrs.Add(en.nextElement().ToString());
                }
            }
            return(attrs.ToArray());
        }
示例#27
0
        // Searches for the property with the specified key in the provider
        // properties. Key is not case-sensitive.
        //
        // @param prop
        // @return the property value with the specified key value.
        private String getPropertyIgnoreCase(String key)
        {
            String res = getProperty(key);

            if (res != null)
            {
                return(res);
            }
            for (java.util.Enumeration <Object> e = propertyNames(); e.hasMoreElements();)
            {
                String pname = (String)e.nextElement();
                if (key.equalsIgnoreCase(pname))
                {
                    return(getProperty(pname));
                }
            }
            return(null);
        }
示例#28
0
    public static object getByInetAddress0(object addr)
    {
#if FIRST_PASS
        return(null);
#else
        foreach (java.net.NetworkInterface iface in GetInterfaces().javaInterfaces)
        {
            java.util.Enumeration addresses = iface.getInetAddresses();
            while (addresses.hasMoreElements())
            {
                if (addresses.nextElement().Equals(addr))
                {
                    return(iface);
                }
            }
        }
        return(null);
#endif
    }
示例#29
0
文件: vfs.cs 项目: sreejukg/ikvm
        private static void Initialize()
        {
            VfsDirectory root = new VfsDirectory();

            root.AddDirectory("lib").AddDirectory("security").Add("cacerts", new VfsCacertsEntry());
            VfsDirectory bin = new VfsDirectory();

            root.Add("bin", bin);
            root.Add("assembly", new VfsAssembliesDirectory());
            AddDummyLibrary(bin, "zip");
            AddDummyLibrary(bin, "awt");
            AddDummyLibrary(bin, "rmi");
            AddDummyLibrary(bin, "w2k_lsa_auth");
            AddDummyLibrary(bin, "jaas_nt");
            AddDummyLibrary(bin, "jaas_unix");
            AddDummyLibrary(bin, "net");
            AddDummyLibrary(bin, "splashscreen");
            AddDummyLibrary(bin, "osx");
            AddDummyLibrary(bin, "management");
            bin.Add("java", new VfsJavaExe());
            bin.Add("javaw", new VfsJavaExe());
            bin.Add("java.exe", new VfsJavaExe());
            bin.Add("javaw.exe", new VfsJavaExe());

            // this is a weird loop back, the vfs.zip resource is loaded from vfs,
            // because that's the easiest way to construct a ZipFile from a Stream.
            //Console.Error.WriteLine($"Opening virtual Zip file: {RootPath + "vfs.zip"}");
            java.util.zip.ZipFile zf = new java.util.zip.ZipFile(RootPath + "vfs.zip");
            java.util.Enumeration e  = zf.entries();
            while (e.hasMoreElements())
            {
                AddZipEntry(zf, root, (java.util.zip.ZipEntry)e.nextElement());
            }

            // make "lib/security/local_policy.jar" point to "lib/security/US_export_policy.jar"
            // to get the unrestricted crypto policy
            VfsDirectory security = (VfsDirectory)((VfsDirectory)root.GetEntry("lib")).GetEntry("security");

            security.Add("local_policy.jar", security.GetEntry("US_export_policy.jar"));

            Interlocked.CompareExchange(ref VirtualFileSystem.root, root, null);
        }
示例#30
0
            public LookupProvidersIterator(java.lang.Class providerClass, java.lang.ClassLoader loader)
            {
                this.loader = loader;

                java.util.Enumeration <java.net.URL> e = null;
                try
                {
                    e = loader.getResources("META-INF/services/" + providerClass.getName()); //$NON-NLS-1$
                    while (e.hasMoreElements())
                    {
                        java.util.Set <String> names = parse((java.net.URL)e.nextElement());
                        providerNames.addAll(names);
                    }
                }
                catch (java.io.IOException e1)
                {
                    // Ignored
                }

                it = providerNames.iterator();
            }
示例#31
0
        public void setClientInfo(java.util.Properties props)
        {
            java.util.HashMap <String, java.sql.ClientInfoStatus> errors = new java.util.HashMap <String, java.sql.ClientInfoStatus>();
            java.util.Enumeration <String> names = props.keys();
            String name = null;

            while (names.hasMoreElements())
            {
                try
                {
                    name = names.nextElement();
                    this.setClientInfo(name, props.get(name));
                }
                catch (java.sql.SQLClientInfoException) {
                    errors.put(name, java.sql.ClientInfoStatus.REASON_UNKNOWN);
                }
            }
            if (0 != errors.size())
            {
                throw new java.sql.SQLClientInfoException(errors);
            }
        }
示例#32
0
    public static string[] getMetaInfEntryNames(object thisJarFile)
    {
#if FIRST_PASS
        return(null);
#else
        java.util.zip.ZipFile zf      = (java.util.zip.ZipFile)thisJarFile;
        java.util.Enumeration entries = zf.entries();
        List <string>         list    = null;
        while (entries.hasMoreElements())
        {
            java.util.zip.ZipEntry entry = (java.util.zip.ZipEntry)entries.nextElement();
            if (entry.getName().StartsWith("META-INF/", StringComparison.OrdinalIgnoreCase))
            {
                if (list == null)
                {
                    list = new List <string>();
                }
                list.Add(entry.getName());
            }
        }
        return(list == null ? null : list.ToArray());
#endif
    }
示例#33
0
 /**
  * Closes all streams in this sequence of input stream.
  *
  * @throws IOException
  *             if an error occurs while closing any of the input streams.
  */
 public override void close()
 {
     //throws IOException {
     while (inJ != null) {
         nextStream ();
     }
     e = null;
 }