コード例 #1
0
ファイル: Configure.java プロジェクト: sugiii/scouter
 public String loadText() {
   File file = getPropertyFile();
   InputStream fin = null;
   try {
     fin = new FileInputStream(file);
     byte[] buff = FileUtil.readAll(fin);
     return new String(buff);
   } catch (Exception e) {
   } finally {
     FileUtil.close(fin);
   }
   return null;
 }
コード例 #2
0
ファイル: DirectPatch.java プロジェクト: evanjang/scouter
 static {
   try {
     String patch = Configure.getInstance().direct_patch_class;
     String[] files = StringUtil.tokenizer(patch, ",;");
     for (int i = 0; files != null && i < files.length; i++) {
       byte[] bytes = FileUtil.readAll(new File(files[i]));
       if (bytes != null) {
         String classname = getClassName(bytes);
         if (classname != null) {
           classPatchMap.put(classname, bytes);
         }
       }
     }
   } catch (Throwable t) {
     t.printStackTrace();
   }
 }
コード例 #3
0
ファイル: MemTimeBlock.java プロジェクト: jyleeeee/scouter
  private void open(String path) throws FileNotFoundException, IOException {
    this.path = path;
    this.file = new File(this.path + ".hfile");
    boolean isNew = this.file.exists() == false || this.file.length() < _memHeadReserved;

    if (isNew) {
      this.memBuffer = new byte[_memHeadReserved + memBufferSize];
      this.memBuffer[0] = (byte) 0xCA;
      this.memBuffer[1] = (byte) 0xFE;
    } else {
      this.memBufferSize = (int) (this.file.length() - _memHeadReserved);
      this.memBuffer = FileUtil.readAll(this.file);
      this.count = DataInputX.toInt(this.memBuffer, _countPos);
    }

    FlushCtr.getInstance().regist(this);
  }
コード例 #4
0
ファイル: LoadTest.java プロジェクト: noir2k/scouter
 private static void process(String arg) throws Exception {
   long stime = System.currentTimeMillis();
   try {
     URL u = new URL(arg);
     URLConnection uc = u.openConnection();
     String uu = setUser(uc);
     uc.connect();
     InputStream o = uc.getInputStream();
     FileUtil.readAll(o);
     Map<String, List<String>> heads = uc.getHeaderFields();
     List<String> cookie = heads.get("Set-Cookie");
     keepCookie("" + cookie);
     o.close();
     long dur = System.currentTimeMillis() - stime;
     System.out.println(arg + " " + dur + " ms " + uu);
   } catch (Exception e) {
     long dur = System.currentTimeMillis() - stime;
     System.out.println(arg + " " + dur + " ms - ERROR");
   }
 }