Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinFactory committed May 16, 2021
2 parents 200828d + 61fa988 commit 570cef1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
15 changes: 4 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

Expand All @@ -24,15 +22,10 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
- OS: [e.g. Ubuntu]
- Version [e.g. 18.04]
**Java**
- Version: [e.g. 1.8.0_291]

**Additional context**
Add any other context about the problem here.
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

Expand Down
33 changes: 33 additions & 0 deletions src/main/java/de/leonhard/storage/Yaml.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import de.leonhard.storage.util.FileUtils;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -193,6 +194,38 @@ public final void addHeader(final String... header) {
addHeader(Arrays.asList(header));
}

public final void framedHeader (final String... header) {
List <String> stringList = new ArrayList <>();
String border = "# +----------------------------------------------------+ #";
stringList.add(border);

for (String line : header) {
StringBuilder builder = new StringBuilder();
if (line.length() > 50) {
continue;
}

int length = (50 - line.length()) / 2;
StringBuilder finalLine = new StringBuilder(line);

for (int i = 0; i < length; i++) {
finalLine.append(" ");
finalLine.reverse();
finalLine.append(" ");
finalLine.reverse();
}

if (line.length() % 2 != 0) {
finalLine.append(" ");
}

builder.append("# < ").append(finalLine.toString()).append(" > #");
stringList.add(builder.toString());
}
stringList.add(border);
setHeader(stringList);
}

public final Optional<InputStream> getInputStream() {
return Optional.ofNullable(this.inputStream);
}
Expand Down

0 comments on commit 570cef1

Please sign in to comment.