Пример #1
0
 protected void addSection(String name, String fileName, InputStream is, boolean limitSize) {
   int limit = Integer.MAX_VALUE;
   if (limitSize) {
     limit = mContext.getLimit();
   }
   String headerLine = name + ": " + fileName;
   Section sl = new Section(this, name);
   int ret = readFile(sl, fileName, is, limit);
   if (ret == READ_FAILED) {
     headerLine += "<span style=\"color: #f00;\"> (READ FAILED!)</span>";
   } else if (ret == READ_PARTS) {
     headerLine +=
         "<span style=\"color: #f00;\"> (READ LAST " + (limit / 1024 / 1024) + "MB ONLY!)</span>";
     addSection(sl);
   } else if (ret == READ_ALL) {
     addSection(sl);
   }
   addHeaderLine(headerLine);
   addSource(new SourceFile(fileName, name));
 }
Пример #2
0
  public boolean addFile(String fileName, String type, boolean limitSize) {
    // Check if any of the plugins would like to handle this
    for (Plugin p : mPlugins) {
      if (p.handleFile(this, fileName, type)) {
        return true;
      }
    }

    // If type is specified, add the section
    if (type != null && Section.isSection(type)) {
      addSection(type, fileName, null, limitSize);
      return true;
    }
    return false;
  }