6.6 Profile: Connecting and Reading the Input File

<..void buildProfile( boolean trace )..>
 public void buildProfile( boolean trace ){
    if( trace ){
       log.println(
          "xtpipes (2014-05-24-12:32)"
          + "\n   java.version: "    + System.getProperty("java.version")
          + "\n   java.class.path: " + System.getProperty("java.class.path")
          + "\n   os.name: "         + System.getProperty("os.name")
          + "\n   user.home: "       + System.getProperty("user.home")
          + "\n   user.dir: "        + System.getProperty("user.dir")
            );
    }
    if( connection != null ){
      <.profile info from connection.>
    }
    <.profile from preamble of file.>
    if( trace ){
       log.println(
            " url = "           + url
          + "\n contentType = " + contentType
          + "\n publicId = "    + publicId
          + "\n systemId = "    + systemId
          + "\n xtpipes = "     + xtpipes
          + "\n root = "        + root
          + "\n dtdRoot = "     + dtdRoot
       );
 }  }
 -_-_-

<..profile info from connection..>
 contentType = connection . getContentType();
 url = connection . getURL() . toString();
 -_-_-

<..profile from preamble of file..>
 int max = 8192;
 int buffSize = 4096;
 byte [] buff = new byte [ buffSize ];
 int m = 0;
 int length = 0;
 int ch;
 int type = <.undef type.>;
 String token = null;
 while( m < max ){
    try{
       int k = Math.min( max - m, buffSize );
       length = inputStream.read( buff, 0, k );
       if( length == -1 ){ break; }
       if( length == 0  ){ continue; }
    } catch (java.io.IOException e){
       System.err.println( "--- xtpipes error --- : " + e );
       break;
    }
    for(int i = 0 ; i < length; i++ ){
      <.search preamble info.>
      m++;
 }  }
 -_-_-