Skip to content

Instantly share code, notes, and snippets.

donchan922 donchan922

Block or report user

Report or block donchan922

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DemoApplication.java
String[] array = {"Alice", "Bob", "Carol"};
System.out.println(String.join("\t", array)); // Alice Bob Carol
View DemoApplication.java
List<String> list = new ArrayList<>();
list.add("Alice");
list.add("Bob");
list.add("Carol");
System.out.println(String.join(",", list)); // Alice,Bob,Carol
View DemoApplication.java
String[] array = {"Alice", "Bob", "Carol"};
System.out.println(String.join(",", array)); // Alice,Bob,Carol
View with_header_tsv
id name age
001 Alice 18
002 Bob 25
003 Carol 23
View with_header_tsv
id name age
001 Alice 18
002 Bob 25
003 Carol 23
View DemoApplication.java
public class DemoApplication {
public static void main(String[] args) throws IOException {
CsvMapper mapper = new CsvMapper();
// ヘッダあり、タブ区切り
CsvSchema schema = mapper.schemaFor(User.class).withHeader().withColumnSeparator('\t');
Path path = Paths.get("TSVファイルのパス");
try (BufferedReader br = Files.newBufferedReader(path)) {
View no_header_tsv
001 Alice 18
002 Bob 25
003 Carol 23
View DemoApplication.java
public class DemoApplication {
public static void main(String[] args) throws IOException {
CsvMapper mapper = new CsvMapper();
// ヘッダなし、タブ区切り
CsvSchema schema = mapper.schemaFor(User.class).withColumnSeparator('\t');
Path path = Paths.get("TSVファイルのパス");
try (BufferedReader br = Files.newBufferedReader(path)) {
View main.sh
$ scp [クライアントの転送元パス] [サーバのログインユーザ]@[サーバのIP or ホスト名]:[サーバの転送先パス]
# 例1. Macのカレントディレクトリの「hoge.txt」をRaspberry Piのホームディレクトリに転送する
$ scp hoge.txt pi@10.253.131.84:~
# 例2. Macの「hoge/hoge.txt」をRaspberry Piの「/home/pi/foo」に転送する
$ scp hoge/hoge.txt pi@10.253.131.84:/home/pi/foo
# 例3. 複数のファイルをまとめて転送する
$ scp hoge.txt bar.txt pi@10.253.131.84:~
View DemoApplication.java
public class DemoApplication {
public static void main(String[] args) throws IOException {
// 空ファイルの格納先を設定する
Path path = Paths.get("/tmp/empty.txt");
try {
// 空ファイルを作成する
Files.createFile(path);
You can’t perform that action at this time.