Package java.lang

Examples of java.lang.String$HashCache


        char[] set = new char[lenght];
        for(int i=0;i<lenght;i++){
            int el = (int)(Math.random()*27);
            set[i] = (char)elements[el];
        }
        return new String(set);
    }
View Full Code Here


    public static boolean testSearch (Trie<String> testTrie, ArrayList <String> words, int show) {
        boolean result = true;
        if (show != 0) System.out.println("Comprovem que paraules aleatories de diferent mida i que no siguin cap de les"
                + " afegides no es trobin al trie: ");
        for (int i = 1; i <= 6; ++i) {
            String singleWord = randomString (i);
            while (words.contains(singleWord)) {
                singleWord = randomString (i);
            }
            result = result && !testTrie.exists(singleWord);
            if (show != 0 && result) System.out.println("La paraula "+singleWord+" no es al trie");
            else if (show !=0) System.out.println("La paraula "+singleWord+" es al trie");
        }
        if (show != 0) System.out.println("Comprovem que una paraula que no sigui cap de les afegides"
                + " al trie, pero comenci igual que una d'elles, no apareixi al trie");
        for (int j = 0; j <= 6; ++j) {
            int i = 0;
            String singleWord = words.get(j+i).substring(0, words.get(j+i).length()-1);
            while (words.contains(singleWord)) {
                singleWord = words.get(j+i).substring(0, words.get(j+i).length()-1);
                ++i;
            }
            result = result && !testTrie.exists(singleWord);
View Full Code Here

     * */
    public static Class<?> forName(String typeName, ClassLoader... classLoaders) {
        if (primitiveNames.contains(typeName)) {
            return primitiveTypes.get(primitiveNames.indexOf(typeName));
        } else {
            String type;
            if (typeName.contains("[")) {
                int i = typeName.indexOf("[");
                type = typeName.substring(0, i);
                String array = typeName.substring(i).replace("]", "");

                if (primitiveNames.contains(type)) {
                    type = primitiveDescriptors.get(primitiveNames.indexOf(type));
                } else {
                    type = "L" + type + ";";
View Full Code Here

      myParser = null;
    } catch (ParseException ex) {
      myParser = null; // let go of the parser reference.
      if (sipStack.isLoggingEnabled()) {
        this.sipStack.logWriter.logDebug("Rejecting message !  "
            + new String(msgBytes));
        this.sipStack.logWriter.logDebug("error message "
            + ex.getMessage());
        this.sipStack.logWriter.logException(ex);
      }
     

      // JvB: send a 400 response for requests (except ACK)
      // Currently only UDP, @todo also other transports
      String msgString = new String(msgBytes, 0, packetLength);
      if (!msgString.startsWith("SIP/") && !msgString.startsWith("ACK ")) {

        String badReqRes = createBadReqRes(msgString, ex);
        if (badReqRes != null) {
          if (sipStack.isLoggingEnabled()) {
            sipStack.getLogWriter().logDebug(
                "Sending automatic 400 Bad Request:");
            sipStack.getLogWriter().logDebug(badReqRes);
          }
          try {
            this.sendMessage(badReqRes.getBytes(), peerAddress,
                packet.getPort(), "UDP", false);
          } catch (IOException e) {
            this.sipStack.logWriter.logException(e);
          }
        } else {
          if (sipStack.isLoggingEnabled()) {
            sipStack
                .getLogWriter()
                .logDebug(
                    "Could not formulate automatic 400 Bad Request");
          }
        }
      }

      return;
    }
    // No parse exception but null message - reject it and
    // march on (or return).
    // exit this message processor if the message did not parse.

    if (sipMessage == null) {
      if (sipStack.isLoggingEnabled()) {
        this.sipStack.logWriter.logDebug("Rejecting message !  + Null message parsed.");
      }
      return;
    }
    ViaList viaList = sipMessage.getViaHeaders();
    // Check for the required headers.
    if (sipMessage.getFrom() == null || sipMessage.getTo() == null
        || sipMessage.getCallId() == null
        || sipMessage.getCSeq() == null
        || sipMessage.getViaHeaders() == null) {
      String badmsg = new String(msgBytes);
      if (sipStack.isLoggingEnabled()) {
        this.sipStack.logWriter.logError("bad message " + badmsg);
        this.sipStack.logWriter.logError(">>> Dropped Bad Msg "
            + "From = " + sipMessage.getFrom() + "To = "
            + sipMessage.getTo() + "CallId = "
View Full Code Here

      }
      throw new IOException("Receiver port not set ");
    } else {
      if (sipStack.isLoggingEnabled()) {
        this.sipStack.logWriter.logDebug("sendMessage " + peerAddress.getHostAddress() + "/"
            + peerPort + "\n" + "messageSize =  "  + msg.length + " message = " + new String(msg)) ;
        this.sipStack.logWriter.logDebug("*******************\n");
      }

    }
    DatagramPacket reply = new DatagramPacket(msg, msg.length, peerAddress,
View Full Code Here

      throw new IOException("Receiver port not set ");
    } else {
      if (sipStack.isLoggingEnabled()) {
        this.sipStack.logWriter.logDebug( ":sendMessage " + peerAddress.getHostAddress() + "/"
            + peerPort + "\n" + " messageSize = " + msg.length
            + "\n message = "+ new String(msg));
        this.sipStack.logWriter.logDebug("*******************\n");
      }
    }
    if (peerProtocol.compareToIgnoreCase("UDP") == 0) {
      DatagramPacket reply = new DatagramPacket(msg, msg.length,
          peerAddress, peerPort);

      try {
        DatagramSocket sock;
        if (sipStack.udpFlag) {
          sock = ((UDPMessageProcessor) messageProcessor).sock;

        } else {
          // bind to any interface and port.
          sock = sipStack.getNetworkLayer().createDatagramSocket();
        }
        if (sipStack.isLoggingEnabled()) {
          this.sipStack.logWriter.logDebug("sendMessage "
              + peerAddress.getHostAddress() + "/" + peerPort
              + "\n" + new String(msg));
        }
        sock.send(reply);
        if (!sipStack.udpFlag)
          sock.close();
      } catch (IOException ex) {
View Full Code Here

            IllegalAccessException
    {
        Hashtable sources = new Hashtable();   

        // fetch system property:
        String p = System.getProperty(PROPERTY);
        if (p != null) {
            StringTokenizer st = new StringTokenizer(p);
            while (st.hasMoreTokens()) {
                String sourceName = st.nextToken();
                // Use context class loader, falling back to Class.forName
                // if and only if this fails...
                Object source = getClass(sourceName).newInstance();
                sources.put(sourceName, source);
            }
View Full Code Here

    public DOMImplementation getDOMImplementation(String features)
            throws ClassNotFoundException,
            InstantiationException, IllegalAccessException, ClassCastException
    {
        Enumeration names = sources.keys();
        String name = null;
        while(names.hasMoreElements()) {
            name = (String)names.nextElement();
            DOMImplementationSource source =
                (DOMImplementationSource) sources.get(name);
View Full Code Here

            throws ClassNotFoundException,
            InstantiationException, IllegalAccessException, ClassCastException
    {
        Enumeration names = sources.keys();
        DOMImplementationListImpl list = new DOMImplementationListImpl();
        String name = null;
        while(names.hasMoreElements()) {
            name = (String)names.nextElement();
            DOMImplementationSource source =
                (DOMImplementationSource) sources.get(name);
View Full Code Here

     */
    public void addSource(DOMImplementationSource s)
            throws ClassNotFoundException,
            InstantiationException, IllegalAccessException
    {
        String sourceName = s.getClass().getName();
        sources.put(sourceName, s);
    }
View Full Code Here

TOP

Related Classes of java.lang.String$HashCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.