forked from wenbochang888/house
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
changwenbo
committed
Oct 18, 2019
1 parent
cfc1959
commit ef663e7
Showing
6 changed files
with
128 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.tianya.util; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.io.BufferedOutputStream; | ||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.util.List; | ||
|
||
/** | ||
* @author changwenbo | ||
* @date 2019/10/18 16:58 | ||
*/ | ||
@Slf4j | ||
public class FileUtils { | ||
|
||
private static final String PREFIX = "### ==**"; | ||
private static final String SUFFIX = "楼: **==" + "\n"; | ||
|
||
/** 写入文件中,转化为PDF文档 */ | ||
public static void writeFile(List<String> res) { | ||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File("d:\\house.md")))) { | ||
int cnt = 1; | ||
for (String s : res) { | ||
// markdown格式 | ||
String ss = PREFIX + cnt + SUFFIX + "\n"; | ||
bos.write(ss.getBytes()); | ||
// 真正数据 | ||
bos.write(s.getBytes()); | ||
cnt++; | ||
} | ||
System.out.println("success"); | ||
} catch (Exception e) { | ||
log.error("写入文件出错:" + e.getMessage()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.