Log in Page Discussion History Go to the site toolbox

David Vallner/Code Wonders

From BluWiki

Code Wonders

 private String readContextFile() {
   InputStream contextStream = getClass().getResourceAsStream("/conf/Context.uicontext");
   StringBuffer input = new StringBuffer();
   try {
     boolean read = true;
     boolean msgComplete = false;
     try {
       while (read && !msgComplete) {
         int c = 0;
         switch (c = contextStream.read()) 
         //switch (c = socketInput.read())
         {
         case 2:
           break; // STX -- start text
         case 3:
           read = false;
           msgComplete = true; // ETX -- end text
         case -1:
           msgComplete = true;
           break;
         default:
           input.append((char) c);
           break;
         }
       }
     } catch (IOException e) {
       System.out.println("read exception");
       e.printStackTrace();
     }
     System.out.println("Properties loaded");
   } catch (Exception ex) {
     ex.printStackTrace();
   } finally {
     try {
       if (contextStream != null)
         contextStream.close();
     } catch (IOException e) {}
   }
   return input.toString();
 }

Site Toolbox:

Personal tools
GNU Free Documentation License 1.2
This page was last modified on 30 June 2006, at 18:27.
Disclaimers - About BluWiki