コード例 #1
0
ファイル: WhoisConverter.java プロジェクト: nykma/ykt4sungard
  public Object convert(String id) throws ConverterException {
    Whois whois = null;

    try {
      Socket socket = new Socket(WHOIS_SERVER, WHOIS_SERVER_PORT);
      BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));

      PrintStream out = new PrintStream(socket.getOutputStream());
      out.println(_domain);

      FastStringBuffer sb = new FastStringBuffer();
      String line = null;

      while ((line = br.readLine()) != null) {
        if (line.startsWith("Results ")) {
          break;
        }

        sb.append(line).append("\n");
      }

      br.close();
      socket.close();

      whois = new Whois(_domain, StringUtil.replace(sb.toString().trim(), "\n\n", "\n"));
    } catch (Exception e) {
      throw new ConverterException(_domain + " " + e.toString());
    }

    return whois;
  }
コード例 #2
0
ファイル: WikiUtil.java プロジェクト: nykma/ykt4sungard
  private String _convert(NodeFilter filter, String content) throws IOException {

    if (content == null) {
      return StringPool.BLANK;
    }

    StringWriter out = new StringWriter();

    filter.filter(new StringReader(content), out);

    String newContent = out.toString();

    String portletURLToString = StringPool.BLANK;

    PortletURLImpl portletURL = (PortletURLImpl) filter.getPortletURL();

    if (portletURL != null) {
      portletURL.setParameter("node_id", filter.getNodeId());

      Iterator itr = filter.getTitles().keySet().iterator();

      while (itr.hasNext()) {
        String title = (String) itr.next();

        portletURL.setParameter("page_title", title, false);

        portletURLToString = portletURL.toString();

        newContent =
            StringUtil.replace(
                newContent,
                "[$BEGIN_PAGE_TITLE$]" + title + "[$END_PAGE_TITLE$]",
                portletURLToString);
      }
    }

    return newContent;
  }
コード例 #3
0
ファイル: WCUtil.java プロジェクト: nykma/ykt4sungard
 public static String translate(String text) {
   return StringUtil.replace(
       text, new String[] {" doth ", " hath "}, new String[] {" does ", " has "});
 }