Examples of String


Examples of java.lang.String

public class UrlGrabbers {

    public static List<URL> parseWhitespaceCommaFile(String filename) throws FileNotFoundException, MalformedURLException, IOException {
        List<URL> list = new ArrayList<URL>();
        LineNumberReader lr = new LineNumberReader(new BufferedReader(new FileReader(new File(filename))));
        String line = lr.readLine();
        while (line != null) {
            List<String> s = Arrays.asList(line.split("[\\s,]+"));
            for (String i : s) {
                try {
                    list.add(new URL(i));
                } catch(MalformedURLException ex) {
                   
View Full Code Here

Examples of java.lang.String

    private <T> void unmarshalAndMarshal(Class<T> type, java.lang.String xmlFileName, java.lang.String expectedFile) throws Exception {
        InputStream in = getInputStream(xmlFileName);
        assertNotNull(in);
        Object object = JaxbOpenejbJar2.unmarshal(type, in);

        String actual = JaxbOpenejbJar2.marshal(type, object);

        String expected;
        if (xmlFileName.equals(expectedFile)) {
            expected = readContent(getInputStream(xmlFileName));
        } else {
            expected = readContent(getInputStream(expectedFile));
        }
View Full Code Here

Examples of java.lang.String

   * so if information from the InstructionInfo is to be retained, it must be copied.
   */

  public void enter(InstructionInfo info, XPathContext context) {
    int lineNumber = info.getLineNumber();
    String systemId = info.getSystemId();
    int constructType = info.getConstructType();
    if (utilsStylesheet == null &&
        systemId.indexOf("generate-tests-utils.xsl") != -1) {
      utilsStylesheet = systemId;
      out.println("<u u=\"" + systemId + "\" />");
    } else if (xspecStylesheet == null &&
               systemId.indexOf("/xspec/") != -1) {
      xspecStylesheet = systemId;
      out.println("<x u=\"" + systemId + "\" />");
    }
    if (systemId != xspecStylesheet && systemId != utilsStylesheet) {
      Integer module;
      if (modules.containsKey(systemId)) {
        module = (Integer)modules.get(systemId);
      } else {
        module = new Integer(moduleCount);
        moduleCount += 1;
        modules.put(systemId, module);
        out.println("<m id=\"" + module + "\" u=\"" + systemId + "\" />");
      }
      if (!constructs.contains(constructType)) {
        String construct;
        if (constructType < 1024) {
          construct = StandardNames.getClarkName(constructType);
        } else {
          switch (constructType) {
            case Location.LITERAL_RESULT_ELEMENT:
View Full Code Here

Examples of java.lang.String

        //make the communication
    resourceURL = getApiServer() + resourceURL;
    if(queryParams.keySet().size() > 0){
      int i=0;
      for(String paramName : queryParams.keySet()){
        String symbol = "&";
        if(i==0){
          symbol = "?";
        }
        resourceURL = resourceURL + symbol + paramName + "=" + queryParams.get(paramName);
        i++;
      }
    }
        Map<String, String> headerMap = new HashMap<String, String>();
        if(securityHandler != null){
            securityHandler.populateSecurityInfo(resourceURL, headerMap);
        }
        WebResource aResource = apiClient.resource(resourceURL);


        //set the required HTTP headers
        Builder builder = aResource.type("application/json");
        for(String key : headerMap.keySet()){
            builder.header(key, headerMap.get(key));
        }
        if(headerParams != null){
            for(String key : headerParams.keySet()){
                builder.header(key, headerParams.get(key));
            }
        }

        ClientResponse clientResponse = null;
        if(method.equals(GET)) {
          clientResponse =  builder.get(ClientResponse.class);
        }else if (method.equals(POST)) {
          clientResponse =  builder.post(ClientResponse.class, serialize(postData));
        }else if (method.equals(PUT)) {
          clientResponse =  builder.put(ClientResponse.class, serialize(postData));
        }else if (method.equals(DELETE)) {
          clientResponse =  builder.delete(ClientResponse.class);
        }
       
        //process the response
        if(clientResponse.getClientResponseStatus() == ClientResponse.Status.OK) {
          String response = clientResponse.getEntity(String.class);
      return response;
        }else{
          int responseCode = clientResponse.getClientResponseStatus().getStatusCode() ;
          throw new APIException(responseCode, clientResponse.getEntity(String.class));
        }
View Full Code Here

Examples of java.lang.String

     * @param objects
     * @return
     */
    public static String toPathValue(List objects) {
        StringBuilder out = new StringBuilder();
        String output = "";
        for(Object o: objects){
            out.append(o.toString());
            out.append(",");
        }
        if(out.indexOf(",") != -1) {
View Full Code Here

Examples of java.lang.String

   
    public static String RemoveSpaces(String test){
  System.out.println("\nWorking... Length=" +test.length());
    int i=0;
    int paraBreak=10000;
  String result="";
  char data[]={10};
  char tab[]={13};
  if(test!=null){
      String strArr[]= test.split(new String(data));
      test="";
     
      while (i< strArr.length ){
    //System.out.println("Trying "+ i);
   
View Full Code Here

Examples of java.lang.String

        char data[]={10};
  char tab[]={9};
      if (origString.indexOf("  ")!=-1){
    origString=replaceStr(origString,"  "," <text:s/>");
      }   
       if (origString.indexOf(new String(tab))!=-1){
    origString=replaceStr(origString,new String(tab),"<text:tab-stop/>");
      }   
     
      return origString;
   
  }
View Full Code Here

Examples of java.lang.String

      return origString;
   
  }

  public static String replaceStr(String origString, String origChar, String replaceChar){
         String tmp=""
         int index=origString.indexOf(origChar);
         if(index !=-1){
       while (index !=-1){
           String first =origString.substring(0,index);
           first=first.concat(replaceChar);
           tmp=tmp.concat(first);
           origString=origString.substring(index+1,origString.length());
           index=origString.indexOf(origChar);
           if(index==-1) {
         tmp=tmp.concat(origString);
View Full Code Here

Examples of java.lang.String

  }


    private static String replace(String test){
   int i=0;
   String result="";
   if (test.indexOf("  ",i)!=-1){
    while (test.indexOf("  ",i)!=-1){
        result=result.concat(test.substring(0,test.indexOf("  ",i)));
        result=result.concat(" <text:s/>");
        i=test.indexOf("  ",i)+2;
    }
    return result;
      }
   else{
View Full Code Here

Examples of java.lang.String

              
        for (int i = 0; i < size; i++) {
            in.readFully(b);
            if (b[0]!=ATOM)
                throw new IOException("Invalid data when reading map from binary file");
            String key = DataAtom.read(in).strval();
            Datum value = Tuple.readDatum(in);
            ret.put(key, value);
        }
        return ret;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.