File tree Expand file tree Collapse file tree
src/main/java/de/leonhard/storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22name : Bug report
33about : Create a report to help us improve
44title : ' '
5- labels : ' '
6- assignees : ' '
75
86---
97
@@ -24,15 +22,10 @@ A clear and concise description of what you expected to happen.
2422If applicable, add screenshots to help explain your problem.
2523
2624** Desktop (please complete the following information):**
27- - OS: [ e.g. iOS]
28- - Browser [ e.g. chrome, safari]
29- - Version [ e.g. 22]
30-
31- ** Smartphone (please complete the following information):**
32- - Device: [ e.g. iPhone6]
33- - OS: [ e.g. iOS8.1]
34- - Browser [ e.g. stock browser, safari]
35- - Version [ e.g. 22]
25+ - OS: [ e.g. Ubuntu]
26+ - Version [ e.g. 18.04]
27+ ** Java**
28+ - Version: [ e.g. 1.8.0_291]
3629
3730** Additional context**
3831Add any other context about the problem here.
Original file line number Diff line number Diff line change 22name : Feature request
33about : Suggest an idea for this project
44title : ' '
5- labels : ' '
6- assignees : ' '
75
86---
97
Original file line number Diff line number Diff line change 1313import de .leonhard .storage .util .FileUtils ;
1414import java .io .*;
1515import java .nio .charset .StandardCharsets ;
16+ import java .util .ArrayList ;
1617import java .util .Arrays ;
1718import java .util .List ;
1819import java .util .Map ;
@@ -193,6 +194,38 @@ public final void addHeader(final String... header) {
193194 addHeader (Arrays .asList (header ));
194195 }
195196
197+ public final void framedHeader (final String ... header ) {
198+ List <String > stringList = new ArrayList <>();
199+ String border = "# +----------------------------------------------------+ #" ;
200+ stringList .add (border );
201+
202+ for (String line : header ) {
203+ StringBuilder builder = new StringBuilder ();
204+ if (line .length () > 50 ) {
205+ continue ;
206+ }
207+
208+ int length = (50 - line .length ()) / 2 ;
209+ StringBuilder finalLine = new StringBuilder (line );
210+
211+ for (int i = 0 ; i < length ; i ++) {
212+ finalLine .append (" " );
213+ finalLine .reverse ();
214+ finalLine .append (" " );
215+ finalLine .reverse ();
216+ }
217+
218+ if (line .length () % 2 != 0 ) {
219+ finalLine .append (" " );
220+ }
221+
222+ builder .append ("# < " ).append (finalLine .toString ()).append (" > #" );
223+ stringList .add (builder .toString ());
224+ }
225+ stringList .add (border );
226+ setHeader (stringList );
227+ }
228+
196229 public final Optional <InputStream > getInputStream () {
197230 return Optional .ofNullable (this .inputStream );
198231 }
You can’t perform that action at this time.
0 commit comments