Package com.ibm.commons.util

Examples of com.ibm.commons.util.FastStringBuffer


   
    VFSFile f = vfs.getRoot().getChild("Smartcloud").getChild("Profiles").getChild("Get About.js");
    System.out.println("File:"+f.getName());
    InputStream is = f.getInputStream();
    try {
      FastStringBuffer fb = new FastStringBuffer();
      fb.append(new InputStreamReader(is));
      String s = fb.toString();
      System.out.println(s);
    } finally {
      StreamUtil.close(is);
    }
//    VFSFile f = vfs.getRoot();
View Full Code Here


    /**
     * Read a string from a reader.
     * @ibm-api
     */
  public static String readString(Reader reader) throws IOException {
    FastStringBuffer sb = new FastStringBuffer();
    sb.load(reader);
    return sb.toString();
  }
View Full Code Here

    /**
     * Read a string from an input stream using the default encoding.
     * @ibm-api
     */
  public static String readString(InputStream is) throws IOException {
    FastStringBuffer sb = new FastStringBuffer();
    sb.load(new InputStreamReader(is));
    return sb.toString();
  }
View Full Code Here

    /**
     * Read a string from an input stream using a specific encoding.
     * @ibm-api
     */
  public static String readString(InputStream is, String encoding) throws IOException {
    FastStringBuffer sb = new FastStringBuffer();
    sb.load(new InputStreamReader(is,encoding));
    return sb.toString();
  }
View Full Code Here

   
    VFSFile f = vfs.getRoot().getChild("Smartcloud").getChild("Profiles").getChild("Get About.js");
    System.out.println("File:"+f.getName());
    InputStream is = f.getInputStream();
    try {
      FastStringBuffer fb = new FastStringBuffer();
      fb.append(new InputStreamReader(is));
      String s = fb.toString();
      System.out.println(s);
    } finally {
      StreamUtil.close(is);
    }
//    VFSFile f = vfs.getRoot();
View Full Code Here

        if (encoding == null) {
          encoding = UTF8;
        }
        Reader reader = new InputStreamReader(getEntityContent(request, response, entity), encoding);
        try {
          FastStringBuffer b = new FastStringBuffer();
          b.append(reader);
          return b.toString();
        } finally {
          reader.close();
        }
      }
      return null;
View Full Code Here

        }
        return 0;
    }

    private void prtSeparator() throws Exception {
        FastStringBuffer b = new FastStringBuffer();
        int colCount = table.getColumnCount();
        for( int i=0; i<colCount; i++ ) {
            int sz = Math.min(table.getColumnSize(i),getMaxColSize());
            b.append( '+' );
            b.repeat( '-', sz );
        }
        b.append( '+' );
        println( b.toString() );
    }
View Full Code Here

        }
        b.append( '+' );
        println( b.toString() );
    }
    private void prtHeader() throws Exception {
        FastStringBuffer b = new FastStringBuffer();
        int colCount = table.getColumnCount();
        for( int i=0; i<colCount; i++ ) {
            int sz = Math.min(table.getColumnSize(i),getMaxColSize());
            b.append( '|' );
            b.append( pad(table.getColumnTitle(i), sz) );
        }
        b.append( '|' );
        println( b.toString() );
    }
View Full Code Here

        }
        b.append( '|' );
        println( b.toString() );
    }
    private void prtRow( IRow row ) throws Exception {
        FastStringBuffer b = new FastStringBuffer();
        int colCount = table.getColumnCount();
        for( int i=0; i<colCount; i++ ) {
            int sz = Math.min(table.getColumnSize(i),getMaxColSize());
            b.append( '|' );
            b.append( pad(colString(row,i), sz) );
        }
        b.append( '|' );
        println( b.toString() );
    }
View Full Code Here

 
      public static String escapeXMLChars(String s) {
          if( StringUtil.isEmpty(s) ) {
                return s;
            }
            FastStringBuffer b = null;
            int length = s.length();
            for( int i=0; i<length; i++ ) {
                char c = s.charAt(i);

                // Is it a specific entity ?
                String replaceLabel=null;
                String replaceNumber=null;
              
                if (c<256) {
                    replaceLabel=xmlEntities[c];
                }
                if (replaceLabel!=null || replaceNumber!=null) {
                    if( b==null ) {
                        b = new FastStringBuffer();
                        b.append(s, 0, i);
                    }
                    b.append("&"); //$NON-NLS-1$
                    if (replaceLabel!=null) {
                        b.append(replaceLabel);
                    } else {
                        b.append("#"); //$NON-NLS-1$
                        b.append(replaceNumber);
                    }
                    b.append(";"); //$NON-NLS-1$
                } else if( b!=null ) {
                    b.append(c);
                }
            }
            return b!=null ? b.toString() : s;
       
      }
View Full Code Here

TOP

Related Classes of com.ibm.commons.util.FastStringBuffer

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.