加载配置文件
@param in 文件输入流
439971
private static void loadConf(InputStream in) {
        try(BufferedReader reader = new BufferedReader(new InputStreamReader(in, "utf-8"))){
            String line;
            while((line = reader.readLine()) != null){
                line = line.trim();                
                if("".equals(line) || line.startsWith("#")){
                    continue;
                }
                int index = line.indexOf("=");
                if(index==-1){
                    LOGGER.error("错误的配置："+line);
                    continue;
                }
                //有K V
                if(index>0 && line.length()>index+1) {
                    String key = line.substring(0, index).trim();
                    String value = line.substring(index + 1, line.length()).trim();
                    conf.put(key, value);
                }
                //有K无V
                else if(index>0 && line.length()==index+1) {
                    String key = line.substring(0, index).trim();
                    conf.put(key, "");
                }else{
                    LOGGER.error("错误的配置："+line);
                }
            }
        } catch (IOException ex) {
            System.err.println("配置文件加载失败:"+ex.getMessage());
            throw new RuntimeException(ex);
        }
    }
1183671
public void initLoad(String configClass, String xmlLocations, String handlerLocations) {
        // 设置配置的文件路径的值，并开始加载ZealotConfig配置信息
        this.xmlLocations = xmlLocations;
        this.handlerLocations = handlerLocations;
        this.initLoad(configClass);
    }
864790
function load(inPath)
{
  var keys;

  // Group description file can be specified as relative to CWD
  var configFilePath = pathlib.resolve(process.cwd(),inPath);

  // Paths are relative to the config file (inPath) + /public by default
  var configDir = pathlib.dirname(configFilePath);
  var baseDir = pathlib.resolve(configDir,'public');

  // Load the JSON description of the groups
  var input = JSON.parse(stripJsonComments(fs.readFileSync(configFilePath,'utf8')));
  var ret = {};

  // 1. Resolve everything to absolute paths

  // 1a. Root file dirs -- relative to the config file
  ret.rootFileDirs = (input.rootFileDirs||[]).map(function(path) {
    return pathlib.resolve(configDir, path);
  });

  // 1b. Static file dirs -- relative to the config file
  ret.staticFileDirs = {};
  keys = Object.keys(input.staticFileDirs||{});
  keys.forEach(function(key) {
    var paths = input.staticFileDirs[key];
    if ( !util.isArray(paths) )
      paths = [paths];

    ret.staticFileDirs[key] = paths.map(function(path) {
      return pathlib.resolve(configDir, path);
    });
  });

  // 1c. Groups
  keys = Object.keys(input.groups||{});

  // Loop over each group definition
  ret.groups = {};
  keys.forEach(function(groupName) {
    var group = input.groups[groupName];
    var subKeys = Object.keys(group);

    var newGroup = {};

    // You can override the base directory per-group
    if ( group.baseDir )
    {
      var paths = group.baseDir;
      if ( !util.isArray(paths) )
        paths = [paths];

      newGroup.customBaseDir = true;
      newGroup.baseDir = paths.map(function(path) {
        // If baseDir is specified for the group, it's relative to the location of the asset file
        return pathlib.resolve(configDir, path);
      });
    }
    else
    {
      newGroup.customBaseDir = false;
      newGroup.baseDir = [baseDir];
    }

    newGroup.include = group.include || [];

    // Loop over each key in the group definition
    subKeys.forEach(function(subKey) {
      if ( SPECIAL_KEYS.indexOf(subKey) >= 0 )
      {
        // We've already dealt with these
        return;
      }

      if ( HANDLER_KEYS.indexOf(subKey) === -1 )
      {
        throw new Error('Unknown group property: '+ subKey);
      }

      // Resolve file names into absolute paths
      newGroup[subKey] = (group[subKey]||[]).map(function(filename) {
        return resolveFile(newGroup.baseDir, !newGroup.customBaseDir, filename, subKey);
      });
    });

    ret.groups[groupName] = newGroup;
  });

  // 2. Process each group into a flat list of the file names needed
  keys = Object.keys(ret.groups);
  keys.forEach(function(groupName) {
    var flattened = _flatten(ret.groups, groupName);

    // Remember if we're supposed to save the output or not for compliling
    flattened.saveOutput = input.groups[groupName].saveOutput !== false;

    ret.groups[groupName] = flattened;
  });

  return ret;
}
593682
public static void write(InputStream in, File file) {
        write(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
    }
1052727
public<IN,S> void load(IN in, Parse<IN, S> parser) throws IOException, ParseException {
		extract(in,(Writer)null, parser);
	}
1161436
public final void fileCopy(URL in, File out) throws IOException {
		assert in != null;
		try (InputStream inStream = in.openStream()) {
			try (OutputStream outStream = new FileOutputStream(out)) {
				final byte[] buf = new byte[FILE_BUFFER];
				int len;
				while ((len = inStream.read(buf)) > 0) {
					outStream.write(buf, 0, len);
				}
			}
		} finally {
			getBuildContext().refresh(out);
		}
	}
534378
public static void copy(byte[] in, File out) throws IOException {
        assert in != null : "No input byte array specified";
        assert out != null : "No output File specified";
        ByteArrayInputStream inStream = new ByteArrayInputStream(in);
        OutputStream outStream = new BufferedOutputStream(Files.newOutputStream(out.toPath()));
        copy(inStream, outStream);
    }
225645
public static byte[] toByteArray(InputStream in) throws IOException {
    checkNotNull(in, "in");
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      copy(in, out);
      return out.toByteArray();
    } finally {
      ensureClosed(in);
    }
  }
926975
protected void addFileInput(CmsFileInput fileInput) {

        // add the files selected by the user to the list of files to upload
        if (fileInput != null) {
            addFiles(Arrays.asList(fileInput.getFiles()));
        } else {
            loadAndShow();
        }
    }
564494
public void load(String file) throws Exception {

		try {
			InputStreamReader  read = new InputStreamReader (new FileInputStream(file),"utf-8");
			BufferedReader lbin = new BufferedReader(read);
			String str;
			while((str=lbin.readLine())!=null){
				if(str.length()==0)
					continue;
				if(str.charAt(0)=='#')
					continue;
				add(new BaseTemplet(gid++, str));
			}
			lbin.close();
		} catch (IOException e1) {
			e1.printStackTrace();
			throw new Exception("读入模板错误");
		}catch (Exception e) {
			e.printStackTrace();
			throw new Exception("读入模板错误");
		}
	}
963576
public void registerConfig(InputStream in) {
        List<BeanMappingObject> objects = BeanMappingParser.parseMapping(in);
        for (BeanMappingObject object : objects) {
            register(object);
        }
    }
516787
public void in2in(String in, Object... to) {
        for (Object cmd : to) {
            in2in(in, cmd, in);
        }
    }
829766
public void readAll(InputStream in) throws IOException {
    int read = 0;
    do {
      grow(length);
      read = data.setBytes(length, in, data.length() - length);
      if (read > 0) {
        length += read;
      }
    } while (in.available() > 0);
  }
737299
public static final byte[] loadByteArray(final InputStream in) {
		try {
			final ByteArrayOutputStream bOut = new ByteArrayOutputStream();

			final byte buffer[] = new byte[2048];

			int iNbByteRead = -1;

			while ((iNbByteRead = in.read(buffer)) != -1) {
				bOut.write(buffer, 0, iNbByteRead);
			}

			return bOut.toByteArray();
		} catch (final IOException ioe) {
			return null;
		}
	}
965567
private static void addFile(InputStream in, String path, ZipOutputStream out) throws UtilException {
		if (null == in) {
			return;
		}
		try {
			out.putNextEntry(new ZipEntry(path));
			IoUtil.copy(in, out);
		} catch (IOException e) {
			throw new UtilException(e);
		} finally {
			closeEntry(out);
		}
	}
1178577
public void addPrefixesFile(String filename) throws IOException {
    try (Reader r = Files.newBufferedReader(Paths.get(filename), StandardCharsets.UTF_8)) {
      addPrefixProperties(r);
    }
  }
1011741
public void addFile(String path) throws LoadModelException{
		try {
			ArrayList<String[]> al = loadDict(path);		
			add(al); 
			indexLen = MIN_LEN;
			createIndex();
		} catch (IOException e) {
			throw new LoadModelException("加载词典错误"+e.toString());
		}
	}