Java 类java.util.Enumeration 实例源码

项目:nexus-repository-r    文件:RMetadataUtils.java   
/**
 * Parses metadata stored in a Debian Control File-like format.
 *
 * @see <a href="https://cran.r-project.org/doc/manuals/r-release/R-exts.html#The-DESCRIPTION-file">Description File</a>
 */
public static Map<String, String> parseDescriptionFile(final InputStream in) {
  checkNotNull(in);
  try {
    LinkedHashMap<String, String> results = new LinkedHashMap<>();
    InternetHeaders headers = new InternetHeaders(in);
    Enumeration headerEnumeration = headers.getAllHeaders();
    while (headerEnumeration.hasMoreElements()) {
      Header header = (Header) headerEnumeration.nextElement();
      String name = header.getName();
      String value = header.getValue()
          .replace("\r\n", "\n")
          .replace("\r", "\n"); // TODO: "should" be ASCII only, otherwise need to know encoding?
      results.put(name, value); // TODO: Supposedly no duplicates, is this true?
    }
    return results;
  } catch (MessagingException e) {
    throw new RException(null, e);
  }
}
项目:OpenJSharp    文件:SnmpMibAgent.java   
/**
 * This method creates a new Vector which does not contain the first
 * element up to the specified limit.
 *
 * @param original The original vector.
 * @param limit The limit.
 */
private Vector<SnmpVarBind> splitFrom(Vector<SnmpVarBind> original, int limit) {

    int max= original.size();
    Vector<SnmpVarBind> result= new Vector<>(max - limit);
    int i= limit;

    // Ok the loop looks a bit strange. But in order to improve the
    // perf, we try to avoid reference to the limit variable from
    // within the loop ...
    //
    for(Enumeration<SnmpVarBind> e= original.elements(); e.hasMoreElements(); --i) {
        SnmpVarBind var= e.nextElement();
        if (i >0)
            continue;
        result.addElement(new SnmpVarBind(var.oid, var.value));
    }
    return result;
}
项目:Yass    文件:YassLanguageFilter.java   
/**
 * Gets the genericRules attribute of the YassLanguageFilter object
 *
 * @param data Description of the Parameter
 * @return The genericRules value
 */
public String[] getGenericRules(Vector<YassSong> data) {
    Vector<String> langs = new Vector<>();
    for (Enumeration<?> e = data.elements(); e.hasMoreElements(); ) {
        YassSong s = (YassSong) e.nextElement();
        String lang = s.getLanguage();
        if (lang == null || lang.length() < 1) {
            continue;
        }
        if (!langs.contains(lang)) {
            langs.addElement(lang);

        }
    }
    Collections.sort(langs);

    return langs.toArray(new String[langs.size()]);
}
项目:logistimo-web-service    文件:MachineProtocolMessageHandler.java   
private void replaceIdsWithShortcodes(Vector<Hashtable<String, String>> materials) {
  xLogger.fine("Entered replaceIdsWithShortcodes");
  if (materials == null || materials.isEmpty()) {
    return;
  }
  Enumeration<Hashtable<String, String>> en = materials.elements();
  while (en.hasMoreElements()) {
    Hashtable<String, String> ht = en.nextElement();
    Long materialId = Long.valueOf(ht.get(JsonTagsZ.MATERIAL_ID));
    try {
      IMaterial m = mcs.getMaterial(materialId);
      String shortCode = m.getShortCode();
      String shortName = m.getShortName();
      if (shortCode != null) {
        ht.put(JsonTagsZ.MATERIAL_ID, shortCode);
        xLogger.fine("replaceIdsWithShortcodes: replaced {0} with {1}", materialId, shortCode);
      }
      if (shortName != null && !shortName.isEmpty()) {
        ht.put(JsonTagsZ.NAME, shortName);
      }
    } catch (ServiceException e) {
      xLogger.warn("Unable to get material with ID: {0}", materialId);
    }
  }
  xLogger.fine("Exiting replaceIdsWithShortcodes");
}
项目:incubator-netbeans    文件:MakeNBM.java   
private boolean isSigned(final JarFile jar) throws IOException {
    Enumeration<JarEntry> entries = jar.entries();
    boolean signatureInfoPresent = false;
    boolean signatureFilePresent = false;
    while (entries.hasMoreElements()) {
        String entryName = entries.nextElement().getName();
        if (entryName.startsWith("META-INF/")) {
            if (entryName.endsWith(".RSA") || entryName.endsWith(".DSA")) {
                signatureFilePresent = true;
                if (signatureInfoPresent) {
                    break;
                }
            } else if (entryName.endsWith(".SF")) {
                signatureInfoPresent = true;
                if (signatureFilePresent) {
                    break;
                }
            }
        }
    }
    return signatureFilePresent && signatureInfoPresent;
}
项目:xrd4j    文件:AdapterUtils.java   
/**
 * Fetches MIME header information from HTTP request object.
 *
 * @param req HTTP request object
 * @return MimeHeaders that were extracted from the HTTP request
 */
public static MimeHeaders getHeaders(HttpServletRequest req) {
    Enumeration enumeration = req.getHeaderNames();
    MimeHeaders headers = new MimeHeaders();

    while (enumeration.hasMoreElements()) {
        String name = (String) enumeration.nextElement();
        String value = req.getHeader(name);

        StringTokenizer values = new StringTokenizer(value, ",");
        while (values.hasMoreTokens()) {
            headers.addHeader(name, values.nextToken().trim());
        }
    }
    return headers;
}
项目:jdk8u-jdk    文件:RmiBootstrapTest.java   
/**
 * Parses the password file to read the credentials.
 * Returns an ArrayList of arrays of 2 string:
 * {<subject>, <password>}.
 * If the password file does not exists, return an empty list.
 * (File not found = empty file).
 **/
private ArrayList readCredentials(String passwordFileName)
    throws IOException {
    final Properties pws = new Properties();
    final ArrayList  result = new ArrayList();
    final File f = new File(passwordFileName);
    if (!f.exists()) return result;
    FileInputStream fin = new FileInputStream(passwordFileName);
    try {pws.load(fin);}finally{fin.close();}
    for (Enumeration en=pws.propertyNames();en.hasMoreElements();) {
        final String[] cred = new String[2];
        cred[0]=(String)en.nextElement();
        cred[1]=pws.getProperty(cred[0]);
        result.add(cred);
    }
    return result;
}
项目:BiglyBT    文件:X509Extensions.java   
/**
 * Constructor from two vectors
 *
 * @param objectIDs a vector of the object identifiers.
 * @param values a vector of the extension values.
 */
public X509Extensions(
    Vector      objectIDs,
    Vector      values)
{
    Enumeration e = objectIDs.elements();

    while (e.hasMoreElements())
    {
        this.ordering.addElement(e.nextElement());
    }

    int count = 0;

    e = this.ordering.elements();

    while (e.hasMoreElements())
    {
        DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
        X509Extension           ext = (X509Extension)values.elementAt(count);

        this.extensions.put(oid, ext);
        count++;
    }
}
项目:incubator-netbeans    文件:MainImpl.java   
/** @param en enumeration of URLs */
private static String searchBuildNumber(Enumeration<URL> en) {
    String value = null;
    try {
        java.util.jar.Manifest mf;
        URL u = null;
        while(en.hasMoreElements()) {
            u = en.nextElement();
            InputStream is = u.openStream();
            mf = new java.util.jar.Manifest(is);
            is.close();
            // #251035: core-base now allows impl dependencies, with manually added impl version. Prefer Build-Version.
            value = mf.getMainAttributes().getValue("OpenIDE-Module-Build-Version"); // NOI18N
            if (value == null) {
                value = mf.getMainAttributes().getValue("OpenIDE-Module-Implementation-Version"); // NOI18N
            }
            if (value != null) {
                break;
            }
        }
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    return value;
}
项目:parabuild-ci    文件:ElseTask.java   
public void execute() throws BuildException {
    // execute all nested tasks
    for ( Enumeration e = tasks.elements(); e.hasMoreElements(); ) {
        Task task = ( Task ) e.nextElement();
        if ( task instanceof Breakable ) {
            task.perform();
            if ( ( ( Breakable ) task ).doBreak() ) {
                setBreak( true );
                return ;
            }
        }
        else {
            task.perform();
        }
    }
}
项目:openjdk-jdk10    文件:JarFile.java   
CodeSource[] getCodeSources(URL url) {
    ensureInitialization();
    if (jv != null) {
        return jv.getCodeSources(this, url);
    }

    /*
     * JAR file has no signed content. Is there a non-signing
     * code source?
     */
    Enumeration<String> unsigned = unsignedEntryNames();
    if (unsigned.hasMoreElements()) {
        return new CodeSource[]{JarVerifier.getUnsignedCS(url)};
    } else {
        return null;
    }
}
项目:JavaRushTasks    文件:Solution.java   
public static void writeZipEntriesToFile(String zipFileName, String outputFileName) {
    Charset charset = StandardCharsets.UTF_8;
    Path outputFilePath = Paths.get(outputFileName);

    try {
        try (
                ZipFile zip = new ZipFile(zipFileName);
                BufferedWriter writer = Files.newBufferedWriter(outputFilePath, charset);
        ) {

            String newLine = System.getProperty("line.separator");
            for (Enumeration entries = zip.entries(); entries.hasMoreElements(); ) {
                // Берем имя файла из архива и записываем его в результирующий файл
                // Get the entry name and write it to the output file
                String zipEntryName = ((ZipEntry) entries.nextElement()).getName() + newLine;
                writer.write(zipEntryName, 0, zipEntryName.length());
            }
        }

    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:Dahlem_SER316    文件:AltHTMLWriter.java   
/**
 * Outputs the styles as a single element. Styles are not stored as
 * elements, but part of the document. For the time being styles are
 * written out as a comment, inside a style tag.
 */
void writeStyles(StyleSheet sheet) throws IOException {
    if (sheet != null) {
        Enumeration styles = sheet.getStyleNames();
        if (styles != null) {
            boolean outputStyle = false;
            while (styles.hasMoreElements()) {
                String name = (String) styles.nextElement();
                // Don't write out the default style.
                if (!StyleContext.DEFAULT_STYLE.equals(name)
                    && writeStyle(name, sheet.getStyle(name), outputStyle)) {
                    outputStyle = true;
                }
            }
            if (outputStyle) {
                writeStyleEndTag();
            }
        }
    }
}
项目:OpenJSharp    文件:IDLGenerator.java   
/**
 * Write forward references for referenced interfaces and valuetypes
 * ...but not if the reference is to a boxed IDLEntity,
 * @param refHash Hashtable loaded with referenced types
 * @param p The output stream.
 */
protected void writeForwardReferences(
                                      Hashtable refHash,
                                      IndentingWriter p )
    throws IOException {
    Enumeration refEnum = refHash.elements();
    nextReference:
    while ( refEnum.hasMoreElements() ) {
        Type t = (Type)refEnum.nextElement();
        if ( t.isCompound() ) {
            CompoundType ct = (CompoundType)t;
            if ( ct.isIDLEntity() )
                continue nextReference;                  //ignore IDLEntity reference
        }
        writeForwardReference( t,p );
    }
}
项目:tomcat7    文件:CompressionFilterTestServlet.java   
public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

    ServletOutputStream out = response.getOutputStream();
    response.setContentType("text/plain");

    Enumeration e = ((HttpServletRequest)request).getHeaders("Accept-Encoding");
    while (e.hasMoreElements()) {
        String name = (String)e.nextElement();
        out.println(name);
        if (name.indexOf("gzip") != -1) {
            out.println("gzip supported -- able to compress");
        }
        else {
            out.println("gzip not supported");
        }
    }


    out.println("Compression Filter Test Servlet");
    out.close();
}
项目:FSTestTools    文件:InitLog4jLoggingRule.java   
/**
 * Returns true if it appears that log4j have been previously configured. This code checks to see if there are any appenders defined for log4j
 * which is the definitive way to tell if log4j is already initialized. See http://wiki.apache.org/logging-log4j/UsefulCode
 *
 * @return true if Log4J is configured, false otherwise.
 */
private static boolean isLog4JConfigured() {
    final Enumeration<?> appenders = Logger.getRootLogger().getAllAppenders();
    if (appenders.hasMoreElements()) {
        return true;
    } else {
        final Enumeration<?> loggers = LogManager.getCurrentLoggers();
        while (loggers.hasMoreElements()) {
            final Logger c = (Logger) loggers.nextElement();
            if (c.getAllAppenders().hasMoreElements()) {
                return true;
            }
        }
    }
    return false;
}
项目:tomcat7    文件:ImplicitObjectELResolver.java   
public Map<String,String> getParam() {
    if (this.param == null) {
        this.param = new ScopeMap<String>() {
            @Override
            protected Enumeration<String> getAttributeNames() {
                return page.getRequest().getParameterNames();
            }

            @Override
            protected String getAttribute(String name) {
                return page.getRequest().getParameter(name);
            }
        };
    }
    return this.param;
}
项目:Java_Certificado    文件:CertificadoService.java   
/**
 * Metodo Que retorna um Certificado do Tipo A3
 *
 * @param marca
 * @param dll
 * @param senha
 * @return
 * @throws CertificadoException
 */
public static Certificado certificadoA3(String marca, String dll, String senha) throws CertificadoException {

    Certificado certificado = new Certificado();
    try {
        certificado.setMarcaA3(marca);
        certificado.setSenha(senha);
        certificado.setDllA3(dll);
        certificado.setTipo(Certificado.A3);

        Enumeration<String> aliasEnum = getKeyStore(certificado).aliases();

        certificado.setNome(aliasEnum.nextElement());
        certificado.setVencimento(DataValidade(certificado).toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
        certificado.setDiasRestantes(diasRestantes(certificado));
        certificado.setValido(valido(certificado));
    } catch (KeyStoreException e) {
        throw new CertificadoException("Erro ao carregar informações do certificado:" + e.getMessage());
    }

    return certificado;

}
项目:dxram    文件:ManifestHelper.java   
/**
 * Get the value of a property within the manifest file.
 *
 * @param p_class
 *     Target class within the jar package.
 * @param p_key
 *     Key for the value to get.
 * @return If value is found it is returned as a string, null otherwise.
 */
public static String getProperty(final Class<?> p_class, final String p_key) {
    String value = null;
    try {
        Enumeration<URL> resources = p_class.getClassLoader().getResources("META-INF/MANIFEST.MF");
        while (resources.hasMoreElements()) {
            Manifest manifest = new Manifest(resources.nextElement().openStream());
            // check that this is your manifest and do what you need or get the next one

            Attributes attr = manifest.getMainAttributes();
            value = attr.getValue(p_key);

            if (value != null) {
                break;
            }
        }
    } catch (final IOException e) {
        e.printStackTrace();
    }
    return value;
}
项目:tomcat7    文件:ApplicationContext.java   
/**
 * List resource paths (recursively), and store all of them in the given
 * Set.
 */
private static void listCollectionPaths(Set<String> set,
        DirContext resources, String path) throws NamingException {

    Enumeration<Binding> childPaths = resources.listBindings(path);
    while (childPaths.hasMoreElements()) {
        Binding binding = childPaths.nextElement();
        String name = binding.getName();
        StringBuilder childPath = new StringBuilder(path);
        if (!"/".equals(path) && !path.endsWith("/"))
            childPath.append("/");
        childPath.append(name);
        Object object = binding.getObject();
        if (object instanceof DirContext) {
            childPath.append("/");
        }
        set.add(childPath.toString());
    }

}
项目:ChronoBike    文件:CObjectCatalog.java   
public CEntityFileDescriptor getFileDescriptor(String name)
{
    CEntityFileDescriptor eFD = m_tabFileDescriptor.get(name) ;
    if (eFD != null)
    {
        return  eFD ;
    }

    CDataEntity record = GetDataEntity(name, "") ;
    if (record != null)
    {
        Enumeration<CEntityFileDescriptor> enm = m_tabFileDescriptor.elements() ;
        while (enm.hasMoreElements())
        {
            eFD = enm.nextElement() ;
            CDataEntity r = eFD.GetRecord() ;
            if (r == record)
            {
                return eFD ;
            }
        }
    }
    return null ;
}
项目:org.alloytools.alloy    文件:Version.java   
private static Manifest getManifest() {
    try {
        Enumeration<URL> resources = Version.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            Manifest m = new Manifest(url.openStream());
            String value = m.getMainAttributes().getValue("Bundle-SymbolicName");
            if (value != null && value.equals("org.alloytools.alloy.dist")) {
                return m;
            }
        }
    } catch (IOException e) {
        // we ignore
    }

    return null;
}
项目:Yass    文件:YassSheet.java   
/**
 * Description of the Method
 *
 * @param g2 Description of the Parameter
 */
public void paintVersionsText(Graphics2D g2) {
    if (!versionTextPainted) {
        return;
    }

    int off = 1;
    Enumeration<Vector<YassRectangle>> er = rects.elements();
    for (Enumeration<YassTable> e = tables.elements(); e.hasMoreElements()
            && er.hasMoreElements(); ) {
        YassTable t = e.nextElement();
        Vector<?> r = er.nextElement();
        if (t == table) {
            continue;
        }
        Color c = t.getTableColor();
        paintTableText(g2, t, r, c.darker(), c, off, 0, false);
        off++;
    }
}
项目:istio-ola    文件:OlaController.java   
@CrossOrigin
@RequestMapping(method = RequestMethod.GET, value = "/ola", produces = "text/plain")
@ApiOperation("Returns the greeting in Portuguese")
public String ola(HttpServletRequest request) {
  String hostname = System.getenv().getOrDefault("HOSTNAME", "Unknown");
  Enumeration<String> headerNames = request.getHeaderNames();

  StringBuffer headerMsg = new StringBuffer("{");

  while (headerNames.hasMoreElements()) {
    String headerName = headerNames.nextElement();
    String headerValue = request.getHeader(headerName);
    if (headerValue != null) {
      headerMsg.append(String.format("{\"%s\":\"%s\"}", headerName, headerValue));
      headerMsg.append(",");
    }
  }

  headerMsg.append("}");

  log.info("Request Headers:{}", headerMsg);
  return String.format("Olá de %s", hostname);
}
项目:SER316-Aachen    文件:AltHTMLWriter.java   
/**
 * Outputs the styles as a single element. Styles are not stored as
 * elements, but part of the document. For the time being styles are
 * written out as a comment, inside a style tag.
 */
void writeStyles(StyleSheet sheet) throws IOException {
    if (sheet != null) {
        Enumeration styles = sheet.getStyleNames();
        if (styles != null) {
            boolean outputStyle = false;
            while (styles.hasMoreElements()) {
                String name = (String) styles.nextElement();
                // Don't write out the default style.
                if (!StyleContext.DEFAULT_STYLE.equals(name)
                    && writeStyle(name, sheet.getStyle(name), outputStyle)) {
                    outputStyle = true;
                }
            }
            if (outputStyle) {
                writeStyleEndTag();
            }
        }
    }
}
项目:gemini.blueprint    文件:MockServiceReference.java   
public String[] getPropertyKeys() {
    String[] keys = new String[this.properties.size()];
    Enumeration ks = this.properties.keys();

    for (int i = 0; i < keys.length && ks.hasMoreElements(); i++) {
        keys[i] = (String) ks.nextElement();
    }

    return keys;
}
项目:OpenJSharp    文件:DatatypeLibraryLoader.java   
Enumeration getResources(String resName) {
  try {
    return cl.getResources(resName);
  }
  catch (IOException e) {
    return new Singleton(null);
  }
}
项目:dacapobench    文件:JavaCodeGenerator.java   
/**Generate the parser, lexer, treeparser, and token types in Java */
public void gen() {
    // Do the code generation
    try {
        // Loop over all grammars
        Enumeration grammarIter = behavior.grammars.elements();
        while (grammarIter.hasMoreElements()) {
            Grammar g = (Grammar)grammarIter.nextElement();
            // Connect all the components to each other
            g.setGrammarAnalyzer(analyzer);
            g.setCodeGenerator(this);
            analyzer.setGrammar(g);
            // To get right overloading behavior across hetrogeneous grammars
            setupGrammarParameters(g);
            g.generate();
            // print out the grammar with lookahead sets (and FOLLOWs)
            // System.out.print(g.toString());
            exitIfError();
        }

        // Loop over all token managers (some of which are lexers)
        Enumeration tmIter = behavior.tokenManagers.elements();
        while (tmIter.hasMoreElements()) {
            TokenManager tm = (TokenManager)tmIter.nextElement();
            if (!tm.isReadOnly()) {
                // Write the token manager tokens as Java
                // this must appear before genTokenInterchange so that
                // labels are set on string literals
                genTokenTypes(tm);
                // Write the token manager tokens as plain text
                genTokenInterchange(tm);
            }
            exitIfError();
        }
    }
    catch (IOException e) {
        antlrTool.reportException(e, null);
    }
}
项目:dacapobench    文件:Grammar.java   
/** Print out the grammar without actions */
public String toString() {
    StringBuffer buf = new StringBuffer(20000);
    Enumeration ids = rules.elements();
    while (ids.hasMoreElements()) {
        RuleSymbol rs = (RuleSymbol)ids.nextElement();
        if (!rs.id.equals("mnextToken")) {
            buf.append(rs.getBlock().toString());
            buf.append("\n\n");
        }
    }
    return buf.toString();
}
项目:NBANDROID-V2    文件:MavenDownloader.java   
public static void unzip(File zipFile, File destination)
        throws IOException {
    ZipFile zip = new ZipFile(zipFile);
    try {
        Enumeration<ZipArchiveEntry> e = zip.getEntries();
        while (e.hasMoreElements()) {
            ZipArchiveEntry entry = e.nextElement();
            File file = new File(destination, entry.getName());
            if (entry.isDirectory()) {
                file.mkdirs();
            } else {
                InputStream is = zip.getInputStream(entry);
                File parent = file.getParentFile();
                if (parent != null && parent.exists() == false) {
                    parent.mkdirs();
                }
                FileOutputStream os = new FileOutputStream(file);
                try {
                    IOUtils.copy(is, os);
                } finally {
                    os.close();
                    is.close();
                }
                file.setLastModified(entry.getTime());
                int mode = entry.getUnixMode();
                if ((mode & EXEC_MASK) != 0) {
                    if (!file.setExecutable(true)) {
                    }
                }
            }
        }
    } finally {
        ZipFile.closeQuietly(zip);
    }
}
项目:sstore-soft    文件:HsqlDatabaseProperties.java   
void filterLoadedProperties() {

        Enumeration en = stringProps.propertyNames();

        while (en.hasMoreElements()) {
            String  key    = (String) en.nextElement();
            boolean accept = meta.containsKey(key);

            if (!accept) {
                stringProps.remove(key);
            }
        }
    }
项目:android-apkbox    文件:ApkNative.java   
/**
 * getLibFiles
 *
 * @param zipFile   zipFile
 * @param targetDir targetDir
 */
private final static Map<String, Map<String, String>> getLibFiles(String zipFile, String targetDir) {
    Map<String, Map<String, String>> entryFiles = new HashMap<String, Map<String, String>>();
    try {
        ZipFile zf = new ZipFile(zipFile);
        Enumeration<?> entries = zf.entries();
        while (entries.hasMoreElements()) {
            ZipEntry entry = ((ZipEntry) entries.nextElement());
            if (entry.getName().startsWith("lib/")) {
                String[] entrys = entry.getName().split("/");
                if (entrys.length >= 3) {
                    String abi = entrys[1];
                    String targetEntry = entrys[entrys.length - 1];
                    String libraryEntry = targetDir + "/" + targetEntry;
                    if (entryFiles.containsKey(abi)) {
                        entryFiles.get(abi).put(entry.getName(), libraryEntry);
                    } else {
                        Map<String, String> libs = new HashMap<String, String>();
                        libs.put(entry.getName(), libraryEntry);
                        entryFiles.put(abi, libs);
                    }
                }
            }
        }
        zf.close();
    } catch (Exception e) {
    }
    return entryFiles;
}
项目:ramus    文件:Response.java   
public java.io.PrintStream writeHead() throws IOException {
    final java.io.PrintStream out = new java.io.PrintStream(stream, false, HTTPParser.ENCODING);
    writer = out;
    out.println("HTTP/1.1 200 OK");
    out.println("Server: RamusLightServer");
    out.println("Expires: Mon, 01 Jan 1990 00:00:00 GMT");
    if (contentType != null)
        out.println("Content-type: " + contentType);
    if (contentDisposition != null) {
        out.println("Content-disposition: " + contentDisposition);
    }
    if (ramusContentDisposition != null)
        out.println("Ramus-content-disposition: " + ramusContentDisposition);
    if (cookies.size() > 0) {
        String s = "";
        final Enumeration<String> e = cookies.keys();
        while (e.hasMoreElements()) {
            final String key = e.nextElement();
            s += key + "=" + cookies.get(key) + ";";
            if (e.hasMoreElements())
                s += " ";
        }
        out.println("Set-Cookie: " + s);
    }
    out.println();
    return out;
}
项目:T0rlib4j    文件:InetRange.java   
private boolean checkHostEnding(final String host) {
    final Enumeration<String> enumx = end_names.elements();
    while (enumx.hasMoreElements()) {
        if (host.endsWith(enumx.nextElement())) {
            return true;
        }
    }
    return false;
}
项目:openjdk-jdk10    文件:ReasonFlags.java   
/**
 * Return an enumeration of names of attributes existing within this
 * attribute.
 */
public Enumeration<String> getElements () {
    AttributeNameEnumeration elements = new AttributeNameEnumeration();
    for( int i=0; i<NAMES.length; i++ ) {
        elements.addElement(NAMES[i]);
    }
    return (elements.elements());
}
项目:ipack    文件:RSAPublicKeyStructure.java   
public RSAPublicKeyStructure(
    ASN1Sequence  seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
                + seq.size());
    }

    Enumeration e = seq.getObjects();

    modulus = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
    publicExponent = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
}
项目:myfaces-trinidad    文件:ModifiableAbstractAttributeMap.java   
@Override
public void clear()
{
  final List<K> names = new ArrayList<K>();

  for (final Enumeration<K> e = getAttributeNames(); e.hasMoreElements();)
  {
    names.add(e.nextElement());
  }

  for (final K val : names)
  {
    removeAttribute(val);
  }
}
项目:jdk8u-jdk    文件:BasicTableUI.java   
/**
 * Return the maximum size of the table. The maximum height is the
 * row heighttimes the number of rows.
 * The maximum width is the sum of the maximum widths of each column.
 */
public Dimension getMaximumSize(JComponent c) {
    long width = 0;
    Enumeration enumeration = table.getColumnModel().getColumns();
    while (enumeration.hasMoreElements()) {
        TableColumn aColumn = (TableColumn)enumeration.nextElement();
        width = width + aColumn.getMaxWidth();
    }
    return createTableSize(width);
}
项目:jdk8u-jdk    文件:AquaTableHeaderUI.java   
/**
 * Return the minimum size of the header. The minimum width is the sum of the minimum widths of each column (plus
 * inter-cell spacing).
 */
public Dimension getMinimumSize(final JComponent c) {
    long width = 0;
    final Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
    while (enumeration.hasMoreElements()) {
        final TableColumn aColumn = enumeration.nextElement();
        width = width + aColumn.getMinWidth();
    }
    return createHeaderSizeAqua(width);
}
项目:incubator-netbeans    文件:FilesystemBugsTest.java   
/** #8124 When attributes are deleted from file objects, so that no attributes remain set
 *  on any file objects in a folder, the .nbattrs file should be deleted. When no
 *   attributes remain on a particular file object, that <fileobject> tag should be
 *   deleted from the .nbattrs even if others remain.
 */
public void testDeleteAttrsFileAfterDeleteAttrib() throws Exception {
    FileObject folder = getWriteFolder();
    FileObject fo = folder.getFileObject("testAttr");
    if (fo == null) {
        fo = folder.createData("testAttr");
    }
    // set any attribute
    fo.setAttribute("blbost", "blbost");
    // flush
    System.gc();
    System.gc();
    // delete all attributes
    FileObject fos[] = folder.getChildren();
    for (int i = 0; i < fos.length; i++) {
        Enumeration keys = fos[i].getAttributes();
        while (keys.hasMoreElements()) {
            fos[i].setAttribute((String) keys.nextElement(), null);
        }
    }
    // flush
    System.gc();
    System.gc();
    // test if exists .nbattrs
    File nbattrs = new File(FileUtil.toFile(folder), ".nbattrs");
    assertTrue("Empty nbattrs exists in folder:" + FileUtil.toFile(folder), nbattrs.exists() == false);


}