Java Code Examples for java.io.BufferedWriter#flush()

The following examples show how to use java.io.BufferedWriter#flush() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RunTest.java    From gemfirexd-oss with Apache License 2.0 7 votes vote down vote up
private static void generateUTF8OutFile(File FinalOutFile) throws IOException
{
    if (generateUTF8Out) 
    {
        keepfiles=true;
    	File UTF8OutFile = new File(UTF8OutName);
    	
    	// start reading the .out file back in, using default encoding
    	BufferedReader inFile = new BufferedReader(new FileReader(FinalOutFile));
    	FileOutputStream fos = new FileOutputStream(UTF8OutFile);
    	BufferedWriter bw = new BufferedWriter (new OutputStreamWriter(fos, "UTF-8"));  
    	int c;
    	while ((c = inFile.read()) != -1)
    		bw.write(c);
    	bw.flush();
    	bw.close();
    	fos.close();     
    }
}
 
Example 2
Source File: JFactory.java    From symbolicautomata with Apache License 2.0 6 votes vote down vote up
void bdd_save(BufferedWriter out, int r) throws IOException {
    int[] n = new int[1];

    if (r < 2) {
        out.write("0 0 " + r + "\n");
        return;
    }

    bdd_markcount(r, n);
    bdd_unmark(r);
    out.write(n[0] + " " + bddvarnum + "\n");

    for (int x = 0; x < bddvarnum; x++)
        out.write(bddvar2level[x] + " ");
    out.write("\n");

    bdd_save_rec(out, r);
    bdd_unmark(r);

    out.flush();
    return;
}
 
Example 3
Source File: MusicCFRecommender.java    From TagRec with GNU Affero General Public License v3.0 6 votes vote down vote up
private void printPairwiseSim(String filename) {
	System.out.println("Entries to write: " + this.simMap.size());
	String fileToWrite = "./data/metrics/" + filename + "_cosine_sim.txt";
	//String fileToWrite = "./data/metrics/" + filename + "_jaccard_sim.txt";       
	try {
           FileWriter writer = new FileWriter(new File(fileToWrite));
           BufferedWriter bw = new BufferedWriter(writer);
		for (Map.Entry<String, Double> entry : this.simMap.entrySet()) {
			bw.write(entry.getKey() + ";");
			bw.write(entry.getValue() + "\n");
		}
		bw.flush();
		bw.close();
       } catch (IOException e) {
           e.printStackTrace();
       }     
}
 
Example 4
Source File: OS.java    From Baffle with MIT License 6 votes vote down vote up
@Override
public void run() {
	try {
		BufferedReader in = new BufferedReader(new InputStreamReader(
				mIn));
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
				mOut));
		String line;
		while ((line = in.readLine()) != null) {
			out.write(line);
			out.newLine();
		}
		out.flush();
	} catch (IOException ex) {
		ex.printStackTrace();
	}
}
 
Example 5
Source File: Properties.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void store0(BufferedWriter bw, String comments, boolean escUnicode)
    throws IOException
{
    if (comments != null) {
        writeComments(bw, comments);
    }
    bw.write("#" + new Date().toString());
    bw.newLine();
    synchronized (this) {
        for (Enumeration<?> e = keys(); e.hasMoreElements();) {
            String key = (String)e.nextElement();
            String val = (String)get(key);
            key = saveConvert(key, true, escUnicode);
            /* No need to escape embedded and trailing spaces for value, hence
             * pass false to flag.
             */
            val = saveConvert(val, false, escUnicode);
            bw.write(key + "=" + val);
            bw.newLine();
        }
    }
    bw.flush();
}
 
Example 6
Source File: DbBasedStatisticsMgr.java    From quetzal with Eclipse Public License 2.0 6 votes vote down vote up
private void loadValuesToShark(String optionalTempFilePrefix, String table,  Object... values) {
  String insertBasics = Sqls.getSqls(Store.Backend.shark).getSql("insertLoad").replaceFirst("%s", table);
  try {
	  File loadFile = File.createTempFile(optionalTempFilePrefix!=null?optionalTempFilePrefix:"load", ".load");
	  BufferedWriter out = new BufferedWriter(new FileWriter(loadFile, false));
	  for (int i=0; i< values.length; i++) {
		  if (i>0) {
			  out.write("\t");
		  }
		  out.write(values[i].toString());
	  }
	  out.flush();
	  out.close();
	  insertBasics = insertBasics.replaceFirst("%c", loadFile.getAbsolutePath());
	  SQLExecutor.executeUpdate(con, insertBasics);
} catch (IOException e) {
	throw new SQLExceptionWrapper(e);
}
 }
 
Example 7
Source File: InternalClobTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Transfers data from the source to the destination.
 */
public static long transferData(Reader src, Writer dest, long charsToCopy)
        throws IOException {
    BufferedReader in = new BufferedReader(src);
    BufferedWriter out = new BufferedWriter(dest, BUFFER_SIZE);
    char[] bridge = new char[BUFFER_SIZE];
    long charsLeft = charsToCopy;
    int read;
    while ((read = in.read(bridge, 0, (int)Math.min(charsLeft, BUFFER_SIZE))) > 0) {
        out.write(bridge, 0, read);
        charsLeft -= read;
    }
    in.close();
    // Don't close the stream, in case it will be written to again.
    out.flush();
    return charsToCopy - charsLeft;
}
 
Example 8
Source File: NoraUiCommandLineInterface.java    From NoraUi with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @param gson
 *            is singleton json tool.
 * @param noraUiApplicationFile
 *            Object contain a application file from CLI Files.
 */
private void updateFileApplicationsNoraUiCliFiles(Gson gson, NoraUiApplicationFile noraUiApplicationFile) {
    try (FileWriter fw = new FileWriter(CLI_FILES_DIR + File.separator + CLI_APPLICATIONS_FILES_DIR + File.separator + noraUiApplicationFile.getName() + JSON)) {
        BufferedWriter bw = new BufferedWriter(fw);
        bw.write(gson.toJson(noraUiApplicationFile));
        bw.flush();
        bw.close();
    } catch (IOException e) {
        log.error(TECHNICAL_IO_EXCEPTION, e.getMessage(), e);
    }
}
 
Example 9
Source File: PmsUtil.java    From teaching with Apache License 2.0 5 votes vote down vote up
public static String saveErrorTxtByList(List<String> msg, String name) {
    Date d = new Date();
    String saveDir = "logs" + File.separator + DateUtils.yyyyMMdd.get().format(d) + File.separator;
    String saveFullDir = uploadPath + File.separator + saveDir;

    File saveFile = new File(saveFullDir);
    if (!saveFile.exists()) {
        saveFile.mkdirs();
    }
    name += DateUtils.yyyymmddhhmmss.get().format(d) + Math.round(Math.random() * 10000);
    String saveFilePath = saveFullDir + name + ".txt";

    try {
        //封装目的地
        BufferedWriter bw = new BufferedWriter(new FileWriter(saveFilePath));
        //遍历集合
        for (String s : msg) {
            //写数据
            if (s.indexOf("_") > 0) {
                String arr[] = s.split("_");
                bw.write("第" + arr[0] + "行:" + arr[1]);
            } else {
                bw.write(s);
            }
            //bw.newLine();
            bw.write("\r\n");
        }
        //释放资源
        bw.flush();
        bw.close();
    } catch (Exception e) {
        log.info("excel导入生成错误日志文件异常:" + e.getMessage());
    }
    return saveDir + name + ".txt";
}
 
Example 10
Source File: Spy.java    From MAD-Spy with MIT License 5 votes vote down vote up
/**
 * Adds to an {@link HttpsURLConnection} a {@link JSONObject} as request body
 *
 * @param conn connection to the database
 * @param jsonObject to insert into the body of the request
 * @throws IOException
 */
private void setPostRequestContent(HttpsURLConnection conn, JSONObject jsonObject) throws IOException {
    OutputStream os = conn.getOutputStream();
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
    writer.write(jsonObject.toString());
    writer.flush();
    writer.close();
    os.close();
}
 
Example 11
Source File: RemoteSession.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
private String initialize() throws UnknownHostException, IOException {
    logger.debug("Creating socket for host " + host + " on port " + port);

    socket = new Socket();
    socket.connect(new InetSocketAddress(host, port), 5000);

    logger.debug("Socket successfully created and connected");
    InetAddress localAddress = socket.getLocalAddress();
    logger.debug("Local address is " + localAddress.getHostAddress());

    logger.debug("Sending registration message");
    writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    writer.append((char) 0x00);
    writeText(writer, APP_STRING);
    writeText(writer, getRegistrationPayload(localAddress.getHostAddress()));
    writer.flush();

    InputStream in = socket.getInputStream();
    reader = new InputStreamReader(in);
    String result = readRegistrationReply(reader);
    // sendPart2();
    int i;
    while ((i = in.available()) > 0) {
        in.skip(i);
    }
    return result;
}
 
Example 12
Source File: CEOCSTN2Shop2.java    From AILibs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * prints the root of the network
 *
 * @param bw
 * @param lit
 * @param network
 * @param ordered
 * @param i
 * @throws IOException
 */
private void printNetwork(final BufferedWriter bw, final Literal lit, final TaskNetwork network, final boolean ordered, final int i) throws IOException {
	bw.write(this.indent(i) + "(");
	if (lit.equals(network.getRoot())) {
		if (ordered) {
			bw.write(":ordered\n");
		} else {
			bw.write(":unordered\n");
		}
	}
	// write the parameters of the current literal
	bw.write(this.indent(i + 1) + "(" + lit.getProperty());
	bw.flush();
	for (LiteralParam param : lit.getParameters()) {

		bw.write(" ?" + param.getName());
	}

	bw.write(")\n");

	for (Literal literal : network.getSuccessors(lit)) {
		this.printNetwork(bw, literal, i + 1);
	}

	bw.write(this.indent(i) + ")\n");
	bw.flush();
}
 
Example 13
Source File: TextUtil.java    From util with Apache License 2.0 5 votes vote down vote up
/**
 * 得到这个文本中,包含全部关键字的行。如果一行中只包含部分关键字则此行不符合要求。
 * <br/>将结果集保存到 newfilePath这个文本上,如果文本不存在创建文本,文本存在将追加在文本最后。
 * @param newFile 结果集保存的文本对象。
 * @param keys 需要查找的key。
 * @return List<String> 
 * @throws IOException 读取文本或写入时异常
 */
public void findLineByKeyAnd(String [] keys,File newFile) throws IOException {
	//结果存放的文本。
	if(newFile.exists()){
		newFile.mkdirs();
	}
	//用来写文件。
	FileWriter fw= new FileWriter(newFile,true);
	//创建字符输出流对象  
    BufferedWriter bf= new BufferedWriter(fw); 
       
	BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(this.filePath), charEncode));// 建立BufferedReader对象,并实例化为br
	String line = br.readLine();// 从文件读取一行字符串
	//遍历每一行。
	while (line != null) {
		//本行是否含有这些key
		boolean haveAllKey=true;
		for(String key : keys){
			if(line.indexOf(key)==-1){
				haveAllKey=false;
				break;
			}
		}
		//所有的key都包含,追加到文本中去。
		if(haveAllKey){
			//创建缓冲字符输出流对象,将符合记录的文件追加到新文本中,注意加上换行符。
		    bf.append(line+props.getProperty("line.separator"));  
		    bf.flush();  
		}
		line = br.readLine();// 从文件中继续读取一行数据
	}
	//关闭结果文件的写入流。
	bf.close();  
	
	br.close();// 关闭BufferedReader对象
}
 
Example 14
Source File: SVGShapeXmlTemplateWriter.java    From SVG-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void write(BufferedWriter bw) throws IOException {
    bw.write("<!-- AUTO-GENERATED FILE.  DO NOT MODIFY. -->");
    bw.newLine();
    bw.write("<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" />");
    // The end.
    bw.flush();
    bw.close();
}
 
Example 15
Source File: JavaClassWriter.java    From SVG-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void write(BufferedWriter bw) throws IOException {
    writePackage(bw);
    writeImports(bw);
    writeClassComment(bw);
    writeClass(bw);
    writeFields(bw);
    writeConstructMethods(bw);
    writeMethods(bw);
    writeInnerClasses(bw);
    writeEnd(bw);
    // The end.
    bw.flush();
    bw.close();
}
 
Example 16
Source File: PredictionFileWriter.java    From TagRec with GNU Affero General Public License v3.0 4 votes vote down vote up
public boolean writeResourcePredictionsToFile(String filename, int trainSize, int neighborSize) {
	List<String> resourceList = this.reader.getResources();
	Map<Integer, List<Integer>> resourcesOfTestUsers = this.reader.getResourcesOfTestUsers(trainSize);
	
	try {
		FileWriter writer = new FileWriter(new File("./data/results/" + filename + ".txt"));
		//OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File("./data/results/" + filename + ".txt")), "UTF8");
		BufferedWriter bw = new BufferedWriter(writer);
		
		int i=0;
		for (Integer userID : reader.getUniqueUserListFromTestSet(trainSize)) {
			String resultString = userID + "|";				
			String givenResourcesOfUser = "";
							
			for (Integer resourceID : resourcesOfTestUsers.get(userID)) {
				givenResourcesOfUser += resourceList.get(resourceID) + ", ";
			}				
			if (givenResourcesOfUser != "") {
				givenResourcesOfUser = givenResourcesOfUser.substring(0, givenResourcesOfUser.length() - 2);
			}				
			resultString += givenResourcesOfUser + "|";
							
			int[] recommendedResources = this.results.get(i);
			String recString = "";
			int cnt=0;

			for (int recResourceID : recommendedResources) {
			
				if (cnt++ < 20) {
					recString += resourceList.get(recResourceID) + ", ";
				} else {
					break;
				}
			}				
			if (!recString.equals("")) {
				recString = recString.substring(0, recString.length() - 2);
			}				
			resultString += recString + "\n";
			bw.write(resultString);
			i++;
		}
		
		bw.flush();
		bw.close();
		writer.close();
					
		return true;
	} catch (IOException e) {
		e.printStackTrace();
	}
	
	return false;
}
 
Example 17
Source File: ExceptionHandler.java    From apigee-android-sdk with Apache License 2.0 4 votes vote down vote up
public static void saveException(Throwable exception, CrashManagerListener listener) {
  final Date now = new Date();
  final Writer result = new StringWriter();
  final PrintWriter printWriter = new PrintWriter(result);

  exception.printStackTrace(printWriter);

  try {
    // Create filename from a random uuid
    String filename = UUID.randomUUID().toString();
    String path = Constants.FILES_PATH + "/" + filename + ".stacktrace";
    Log.d(ClientLog.TAG_MONITORING_CLIENT, "Writing unhandled exception to: " + path);
    
    StringBuilder sb = new StringBuilder();
    sb.append("Package: " + Constants.APP_PACKAGE + "\n");
    sb.append("Version: " + Constants.APP_VERSION + "\n");
    sb.append("Android: " + Constants.ANDROID_VERSION + "\n");
    sb.append("Manufacturer: " + Constants.PHONE_MANUFACTURER + "\n");
    sb.append("Model: " + Constants.PHONE_MODEL + "\n");
    sb.append("Date: " + now + "\n");
    sb.append("\n");
    sb.append(result.toString());
    
    String exceptionReport = sb.toString();

    //Uncomment following line to see crash report contents logged
    //Log.d(ClientLog.TAG_MONITORING_CLIENT, exceptionReport);
    
    // Write the stacktrace to disk
    BufferedWriter write = new BufferedWriter(new FileWriter(path));
    write.write(exceptionReport);
    write.flush();
    write.close();
    
    if (listener != null) {
      writeValueToFile(limitedString(listener.getUserID()), filename + ".user");
      writeValueToFile(limitedString(listener.getContact()), filename + ".contact");
      writeValueToFile(listener.getDescription(), filename + ".description");
    }
    
  } 
  catch (Exception another) {
    Log.e(ClientLog.TAG_MONITORING_CLIENT, "Error saving exception stacktrace!\n", another);
  }
}
 
Example 18
Source File: Model.java    From ssj with GNU General Public License v3.0 4 votes vote down vote up
public void save(String path, String name) throws IOException
    {
        if(!_isSetup)
            return;

        File dir = Util.createDirectory(Util.parseWildcards(path));
        if(dir == null)
            return;

        if(name.endsWith(FileCons.FILE_EXTENSION_TRAINER + FileCons.TAG_DATA_FILE))
        {
            name = name.substring(0, name.length()-2);
        }
        else if(!name.endsWith(FileCons.FILE_EXTENSION_TRAINER))
        {
            name += "." + FileCons.FILE_EXTENSION_TRAINER;
        }

        StringBuilder builder = new StringBuilder();

        builder.append("<trainer ssi-v=\"5\" ssj-v=\"");
        builder.append(Pipeline.getVersion());
        builder.append("\">").append(FileCons.DELIMITER_LINE);

        builder.append("<info trained=\"");
        builder.append(isTrained());
        builder.append("\"/>").append(FileCons.DELIMITER_LINE);

        builder.append("<streams>").append(FileCons.DELIMITER_LINE);
        builder.append("<item byte=\"");
        builder.append(input_bytes);
        builder.append("\" dim=\"");
        builder.append(input_dim);
        builder.append("\" sr=\"");
        builder.append(input_sr);
        builder.append("\" type=\"");
        builder.append(input_type);
        builder.append("\"/>").append(FileCons.DELIMITER_LINE);
        builder.append("</streams>").append(FileCons.DELIMITER_LINE);

        builder.append("<classes>").append(FileCons.DELIMITER_LINE);
        for(String className : class_names)
        {
            builder.append("<item name=\"");
            builder.append(className);
            builder.append("\"/>").append(FileCons.DELIMITER_LINE);
        }
        builder.append("</classes>").append(FileCons.DELIMITER_LINE);

        builder.append("<users>").append(FileCons.DELIMITER_LINE);
        builder.append("<item name=\"userLocal\"/>").append(FileCons.DELIMITER_LINE);
        builder.append("</users>").append(FileCons.DELIMITER_LINE);

        String modelFileName = name + "." + _name;
//        String modelOptionFileName = name + "." + _name;

        builder.append("<model create=\"");
        builder.append(_name);
        builder.append("\" stream=\"0\" path=\"");
        builder.append(modelFileName);
        //builder.append("\" option=\"");
        //builder.append(modelOptionFileName);
        builder.append("\"/>").append(FileCons.DELIMITER_LINE);

        builder.append("</trainer>").append(FileCons.DELIMITER_LINE);

        OutputStream ouputStream = new FileOutputStream(new File(dir, name));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(ouputStream));

        writer.write(builder.toString());
        writer.flush();
        writer.close();

        saveModel(new File(dir, modelFileName + "." + FileCons.FILE_EXTENSION_MODEL));
    }
 
Example 19
Source File: PushGateway.java    From client_java with Apache License 2.0 4 votes vote down vote up
void doRequest(CollectorRegistry registry, String job, Map<String, String> groupingKey, String method) throws IOException {
  String url = gatewayBaseURL;
  if (job.contains("/")) {
    url += "job@base64/" + base64url(job);
  } else {
    url += "job/" + URLEncoder.encode(job, "UTF-8");
  }

  if (groupingKey != null) {
    for (Map.Entry<String, String> entry: groupingKey.entrySet()) {
      if (entry.getValue().isEmpty()) {
        url += "/" + entry.getKey() + "@base64/=";
      } else if (entry.getValue().contains("/")) {
        url += "/" + entry.getKey() + "@base64/" + base64url(entry.getValue());
      } else {
        url += "/" + entry.getKey() + "/" + URLEncoder.encode(entry.getValue(), "UTF-8");
      }
    }
  }
  HttpURLConnection connection = connectionFactory.create(url);
  connection.setRequestProperty("Content-Type", TextFormat.CONTENT_TYPE_004);
  if (!method.equals("DELETE")) {
    connection.setDoOutput(true);
  }
  connection.setRequestMethod(method);

  connection.setConnectTimeout(10 * MILLISECONDS_PER_SECOND);
  connection.setReadTimeout(10 * MILLISECONDS_PER_SECOND);
  connection.connect();

  try {
    if (!method.equals("DELETE")) {
      BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8"));
      TextFormat.write004(writer, registry.metricFamilySamples());
      writer.flush();
      writer.close();
    }

    int response = connection.getResponseCode();
    if (response/100 != 2) {
      String errorMessage;
      InputStream errorStream = connection.getErrorStream();
      if(errorStream != null) {
        String errBody = readFromStream(errorStream);
        errorMessage = "Response code from " + url + " was " + response + ", response body: " + errBody;
      } else {
        errorMessage = "Response code from " + url + " was " + response;
      }
      throw new IOException(errorMessage);
    }
  } finally {
    connection.disconnect();
  }
}
 
Example 20
Source File: UnitMdBuilderHandler.java    From xian with Apache License 2.0 4 votes vote down vote up
@Override
public void build() {
    LOG.info("-----unit接口文档开始构建----");
    Multimap<String, UnitProxy> unitMultimap = filter.filter(buildUnits());
    if (unitMultimap == null || unitMultimap.isEmpty()) {
        LOG.info("-----unit接口没扫描到业务模块,退出构建");
        invokeCallback(null);
        return;
    }
    LOG.info(String.format("-----unit接口扫描到业务模块数量:%s", unitMultimap.size()));
    try {
        LOG.info("----unit接口开始生成API文档-----");
        // FileWriter fw = new FileWriter(storePath);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        Writer wout = new OutputStreamWriter(bos);
        BufferedWriter bw = new BufferedWriter(wout);
        bw.write(String.format("# %s", StringUtil.isEmpty(docName) ? EnvUtil.getShortEnvName() + "业务接口文档" : docName));
        // 自定义描述
        if (!StringUtil.isEmpty(subDec)) {
            bw.newLine();
            bw.write(subDec);
        }
        bw.newLine();
        for (String groupName : unitMultimap.keySet()) {
            GroupProxy groupProxy = GroupDiscovery.singleton.newestDefinition(groupName);
            //todo it recommended to use a template to generate this MD fragment.
            bw.write("## " + String.format("%s\r\n", StringUtil.isEmpty(groupProxy.getDescription()) ? groupProxy.getName() : groupProxy.getDescription()));
            bw.newLine();
            bw.write(" 接口列表\r\n");
            Collection<UnitProxy> unitProxies = unitMultimap.get(groupName);
            for (UnitProxy unitBean : unitProxies) {
                if (!unitBean.getMeta().isDocApi()) {
                    LOG.info(String.format(" ---api-doc-unit接口:%s/%s非公开访问的,跳过生成", groupProxy.getName(),
                            unitBean.getName()));
                    continue;
                }
                LOG.info(String.format(" ---api-doc-unit接口开始生成:%s/%s", groupProxy.getName(), unitBean.getName()));

                Input io = unitBean.getInput();
                bw.write(String.format("### /%s/%s", groupProxy.getName(), unitBean.getName()));
                bw.newLine();
                bw.write(String.format(" * 接口描述: %s\r\n",
                        StringUtil.isEmpty(unitBean.getMeta().getDescription()) ? "暂无" : unitBean.getMeta().getDescription()));
                bw.newLine();
                bw.write(" * 调用方式: POST");
                bw.newLine();
                bw.write(" * 入参数据结构说明\r\n");
                bw.newLine();
                bw.write(" <table border='1' class='table table-bordered table-striped table-condensed'>");
                bw.newLine();
                bw.write("<tr><td>名称</td><td>数据类型</td><td>参数说明</td><td>必须</td></tr>");
                bw.newLine();
                // bw.write(" | 名称 | 数据类型 | 参数说明 | 是否是必须的 |\r\n");
                // bw.write(" | ------ | -------- | -------: | :--------:
                // |\r\n");
                if (io != null) {
                    List<Obj> objList = io.getList();
                    for (Obj obj : objList) {
                        bw.write("<tr>");
                        bw.newLine();
                        bw.write(String.format("<td>%s</td><td>%s</td><td>%s</td><td>%s</td>", obj.getName(),
                                obj.getClazz().getName(),
                                StringUtil.isEmpty(obj.getDescription()) ? "暂无" : obj.getDescription(),
                                obj.isRequired() ? "是" : "否"));
                        bw.newLine();
                        bw.write("</tr>");
                    }
                }
                bw.write("</table>\r\n");
                bw.newLine();
                bw.write(" * 返回数据格式\r\n");
                bw.newLine();
                bw.write(String.format("````json\r\n%s\r\n````\r\n",
                        unitBean.getMeta().getSuccessfulUnitResponse() == null ?
                                "暂无" : unitBean.getMeta().getSuccessfulUnitResponse().toVoJSONString(true)));
                bw.write("&nbsp;&nbsp;\r\n");
            }
        }
        bw.write("&nbsp;&nbsp;\r\n");
        bw.flush();
        invokeCallback(bos.toByteArray());
        LOG.info("-----unit接口文档构建完成----");
    } catch (Exception e) {
        LOG.error(e);
    }
}