001package org.unix4j.unix; 002 003import org.unix4j.builder.CommandBuilder; 004import org.unix4j.command.Command; 005import org.unix4j.operation.LineOperation; 006 007import org.unix4j.unix.Cat; 008import org.unix4j.unix.cat.CatOptions; 009import org.unix4j.unix.Cd; 010import org.unix4j.unix.Cut; 011import org.unix4j.unix.cut.CutOptions; 012import org.unix4j.unix.Echo; 013import org.unix4j.unix.echo.EchoOptions; 014import org.unix4j.unix.Find; 015import org.unix4j.unix.find.FindOptions; 016import org.unix4j.unix.From; 017import org.unix4j.unix.Grep; 018import org.unix4j.unix.grep.GrepOptions; 019import org.unix4j.unix.Head; 020import org.unix4j.unix.head.HeadOptions; 021import org.unix4j.unix.Ls; 022import org.unix4j.unix.ls.LsOptions; 023import org.unix4j.unix.Sed; 024import org.unix4j.unix.sed.SedOptions; 025import org.unix4j.unix.Sort; 026import org.unix4j.unix.sort.SortOptions; 027import org.unix4j.unix.Tail; 028import org.unix4j.unix.tail.TailOptions; 029import org.unix4j.unix.Uniq; 030import org.unix4j.unix.uniq.UniqOptions; 031import org.unix4j.unix.Wc; 032import org.unix4j.unix.wc.WcOptions; 033import org.unix4j.unix.Xargs; 034import org.unix4j.unix.xargs.XargsOptions; 035 036/** 037 * Builder for a <b>unix4j</b> command or a chain of joined commands. 038 * Application code does usually not directly refer to this class but uses it 039 * indirectly through the static methods in {@link org.unix4j.Unix4j Unix4j}. 040 * <p> 041 * Note that the command creation methods do not return a new command instance. 042 * Instead, the builder stores the created commands and only returns a 043 * {@link Command} object when the {@link #build()} method is invoked. Most 044 * applications, however, need not to call {@code build()} explicitly. The 045 * command can be built and executed in a single step by calling one of the 046 * {@code toXXX(..)} methods, such as {@link #toStdOut()}, 047 * {@link #toFile(String)} or {@link #toStringResult()}. 048 * <p> 049 * The {@link Command} object returned by the {@link #build()} method can 050 * represent a single command or a chain of commands. In a command chain, the 051 * previous command usually pipes its output as standard input into the 052 * next command (the pipe symbol between two commands in unix). For come 053 * commands, however, chaining has a different interpretation. An example is the 054 * {@code xargs} command: here, the next command after {@code xargs} receives 055 * <i>arguments</i> from {@code xargs} instead of (standard) input. 056 */ 057public interface Unix4jCommandBuilder extends CommandBuilder, 058 Cat.Interface<Unix4jCommandBuilder>, 059 Cd.Interface<Unix4jCommandBuilder>, 060 Cut.Interface<Unix4jCommandBuilder>, 061 Echo.Interface<Unix4jCommandBuilder>, 062 Find.Interface<Unix4jCommandBuilder>, 063 From.Interface<Unix4jCommandBuilder>, 064 Grep.Interface<Unix4jCommandBuilder>, 065 Head.Interface<Unix4jCommandBuilder>, 066 Ls.Interface<Unix4jCommandBuilder>, 067 Sed.Interface<Unix4jCommandBuilder>, 068 Sort.Interface<Unix4jCommandBuilder>, 069 Tail.Interface<Unix4jCommandBuilder>, 070 Uniq.Interface<Unix4jCommandBuilder>, 071 Wc.Interface<Unix4jCommandBuilder>, 072 Xargs.Interface<Unix4jCommandBuilder> { 073 074 075 /* ------------------ cat ------------------ */ 076 /** 077 * Reads the lines from the standard input and writes them to the 078 standard output. 079 * <p> 080 * Note that the method returns {@code this} builder to allow for command 081 * chaining. The command itself is returned by the {@link #build()} method. 082 * See {@link Unix4jCommandBuilder class comments} for more information. 083 * 084 * @return {@code this} builder to allow for method chaining; method 085 * chaining is used here to create command chains; adding a command 086 * to the chain usually means that the previous command <i>pipes</i> 087 * its output to the next command (the pipe symbol in unix) 088 */ 089 @Override 090 Unix4jCommandBuilder cat(); 091 /** 092 * Reads the lines from files specified as arguments and writes them to 093 the standard output. Options can be specified by acronym (with a 094 leading dash "-") or by long name (with two leading dashes "--"). 095 File arguments are expanded if wildcards are used. All file 096 arguments are processed in command-argument order. 097 * <p> 098 * Note that the method returns {@code this} builder to allow for command 099 * chaining. The command itself is returned by the {@link #build()} method. 100 * See {@link Unix4jCommandBuilder class comments} for more information. 101 * 102 * @param args String arguments defining the options and file operands for the 103 command. Options can be specified by acronym (with a leading dash 104 "-") or by long name (with two leading dashes "--"). File arguments 105 are expanded if wildcards are used. 106 * @return {@code this} builder to allow for method chaining; method 107 * chaining is used here to create command chains; adding a command 108 * to the chain usually means that the previous command <i>pipes</i> 109 * its output to the next command (the pipe symbol in unix) 110 */ 111 @Override 112 Unix4jCommandBuilder cat(String... args); 113 /** 114 * Reads the lines from the specified files and writes them to the 115 standard output. The files are processed in command-argument order. 116 * <p> 117 * Note that the method returns {@code this} builder to allow for command 118 * chaining. The command itself is returned by the {@link #build()} method. 119 * See {@link Unix4jCommandBuilder class comments} for more information. 120 * 121 * @param files The input files to be printed; relative paths are not resolved (use 122 the string path argument to enable relative path resolving based on 123 the current working directory). 124 * @return {@code this} builder to allow for method chaining; method 125 * chaining is used here to create command chains; adding a command 126 * to the chain usually means that the previous command <i>pipes</i> 127 * its output to the next command (the pipe symbol in unix) 128 */ 129 @Override 130 Unix4jCommandBuilder cat(java.io.File... files); 131 /** 132 * Reads the lines from the specified inputs and writes them to the 133 standard output. The inputs are processed in command-argument order. 134 * <p> 135 * Note that the method returns {@code this} builder to allow for command 136 * chaining. The command itself is returned by the {@link #build()} method. 137 * See {@link Unix4jCommandBuilder class comments} for more information. 138 * 139 * @param inputs The inputs to be printed. 140 * @return {@code this} builder to allow for method chaining; method 141 * chaining is used here to create command chains; adding a command 142 * to the chain usually means that the previous command <i>pipes</i> 143 * its output to the next command (the pipe symbol in unix) 144 */ 145 @Override 146 Unix4jCommandBuilder cat(org.unix4j.io.Input... inputs); 147 /** 148 * Reads the lines from the standard input and writes them to the 149 standard output; the given options define the details of the output 150 format. 151 * <p> 152 * Note that the method returns {@code this} builder to allow for command 153 * chaining. The command itself is returned by the {@link #build()} method. 154 * See {@link Unix4jCommandBuilder class comments} for more information. 155 * 156 * @param options Options for the cat command. 157 * @return {@code this} builder to allow for method chaining; method 158 * chaining is used here to create command chains; adding a command 159 * to the chain usually means that the previous command <i>pipes</i> 160 * its output to the next command (the pipe symbol in unix) 161 */ 162 @Override 163 Unix4jCommandBuilder cat(CatOptions options); 164 /** 165 * Reads the lines from the specified files and writes them to the 166 standard output; the given options define the details of the output 167 format. The files are processed in command-argument order. 168 * <p> 169 * Note that the method returns {@code this} builder to allow for command 170 * chaining. The command itself is returned by the {@link #build()} method. 171 * See {@link Unix4jCommandBuilder class comments} for more information. 172 * 173 * @param options Options for the cat command. 174 * @param files The input files to be printed; relative paths are not resolved (use 175 the string path argument to enable relative path resolving based on 176 the current working directory). 177 * @return {@code this} builder to allow for method chaining; method 178 * chaining is used here to create command chains; adding a command 179 * to the chain usually means that the previous command <i>pipes</i> 180 * its output to the next command (the pipe symbol in unix) 181 */ 182 @Override 183 Unix4jCommandBuilder cat(CatOptions options, java.io.File... files); 184 /** 185 * Reads the lines from the specified files and writes them to the 186 standard output; the given options define the details of the output 187 format. The path arguments are expanded if wildcards are used and 188 processed in command-argument order. 189 * <p> 190 * Note that the method returns {@code this} builder to allow for command 191 * chaining. The command itself is returned by the {@link #build()} method. 192 * See {@link Unix4jCommandBuilder class comments} for more information. 193 * 194 * @param options Options for the cat command. 195 * @param paths Path names of the input files to be printed; wildcards * and ? are 196 supported; relative paths are resolved on the basis of the current 197 working directory. 198 * @return {@code this} builder to allow for method chaining; method 199 * chaining is used here to create command chains; adding a command 200 * to the chain usually means that the previous command <i>pipes</i> 201 * its output to the next command (the pipe symbol in unix) 202 */ 203 @Override 204 Unix4jCommandBuilder cat(CatOptions options, String... paths); 205 /** 206 * Reads the lines from the specified inputs and writes them to the 207 standard output; the given options define the details of the output 208 format. The inputs are processed in command-argument order. 209 * <p> 210 * Note that the method returns {@code this} builder to allow for command 211 * chaining. The command itself is returned by the {@link #build()} method. 212 * See {@link Unix4jCommandBuilder class comments} for more information. 213 * 214 * @param options Options for the cat command. 215 * @param inputs The inputs to be printed. 216 * @return {@code this} builder to allow for method chaining; method 217 * chaining is used here to create command chains; adding a command 218 * to the chain usually means that the previous command <i>pipes</i> 219 * its output to the next command (the pipe symbol in unix) 220 */ 221 @Override 222 Unix4jCommandBuilder cat(CatOptions options, org.unix4j.io.Input... inputs); 223 224 /* ------------------ cd ------------------ */ 225 /** 226 * Changes the current directory to the user home directory as defined 227 by the execution context (usually the directory specified by the 228 {@code "user.home"} system property). 229 * <p> 230 * Note that the method returns {@code this} builder to allow for command 231 * chaining. The command itself is returned by the {@link #build()} method. 232 * See {@link Unix4jCommandBuilder class comments} for more information. 233 * 234 * @return {@code this} builder to allow for method chaining; method 235 * chaining is used here to create command chains; adding a command 236 * to the chain usually means that the previous command <i>pipes</i> 237 * its output to the next command (the pipe symbol in unix) 238 */ 239 @Override 240 Unix4jCommandBuilder cd(); 241 /** 242 * The current working directory is changed to the given file. If the 243 specified file argument does not represent a valid directory, an 244 exception is thrown. Note that relative paths are not resolved with 245 the (old) current working directory. Use the String path to enable 246 relative path resolving and wildcards. 247 * <p> 248 * Note that the method returns {@code this} builder to allow for command 249 * chaining. The command itself is returned by the {@link #build()} method. 250 * See {@link Unix4jCommandBuilder class comments} for more information. 251 * 252 * @param file the file to use as input; relative paths are not resolved (use the 253 string path argument to enable relative path resolving based on the 254 current working directory). 255 * @return {@code this} builder to allow for method chaining; method 256 * chaining is used here to create command chains; adding a command 257 * to the chain usually means that the previous command <i>pipes</i> 258 * its output to the next command (the pipe symbol in unix) 259 */ 260 @Override 261 Unix4jCommandBuilder cd(java.io.File file); 262 /** 263 * The current working directory is changed to the given file. Relative 264 paths are resolved on the basis of the (old) current working 265 directory. Wildcards are possible if the first matching file 266 represents a directory. If the first file specified by the given 267 path argument is not a valid directory, an exception is thrown. 268 * <p> 269 * Note that the method returns {@code this} builder to allow for command 270 * chaining. The command itself is returned by the {@link #build()} method. 271 * See {@link Unix4jCommandBuilder class comments} for more information. 272 * 273 * @param path the directory to become the new current working directory; 274 wildcards * and ? are supported; relative paths are resolved on the 275 basis of the current working directory. 276 * @return {@code this} builder to allow for method chaining; method 277 * chaining is used here to create command chains; adding a command 278 * to the chain usually means that the previous command <i>pipes</i> 279 * its output to the next command (the pipe symbol in unix) 280 */ 281 @Override 282 Unix4jCommandBuilder cd(String path); 283 284 /* ------------------ cut ------------------ */ 285 /** 286 * Cuts the fields or characters from the input line and writes them to 287 the standard output. Depending on the provided options and operands, 288 range, delimiter or indexes define the cut. 289 * <p> 290 * Note that the method returns {@code this} builder to allow for command 291 * chaining. The command itself is returned by the {@link #build()} method. 292 * See {@link Unix4jCommandBuilder class comments} for more information. 293 * 294 * @param args String arguments defining the options and operands for the command. 295 Options can be specified by acronym (with a leading dash "-") or by 296 long name (with two leading dashes "--"). Operands other than the 297 default "--range" operand have to be prefixed with the operand name 298 (e.g. "--indexes" for subsequent index operand values). 299 * @return {@code this} builder to allow for method chaining; method 300 * chaining is used here to create command chains; adding a command 301 * to the chain usually means that the previous command <i>pipes</i> 302 * its output to the next command (the pipe symbol in unix) 303 */ 304 @Override 305 Unix4jCommandBuilder cut(String... args); 306 /** 307 * Cuts the fields or characters using the given range 308 from the input line and writes them to the output. 309 * <p> 310 * Note that the method returns {@code this} builder to allow for command 311 * chaining. The command itself is returned by the {@link #build()} method. 312 * See {@link Unix4jCommandBuilder class comments} for more information. 313 * 314 * @param options options for the cut command 315 * @param range select only these fields 316 * @return {@code this} builder to allow for method chaining; method 317 * chaining is used here to create command chains; adding a command 318 * to the chain usually means that the previous command <i>pipes</i> 319 * its output to the next command (the pipe symbol in unix) 320 */ 321 @Override 322 Unix4jCommandBuilder cut(CutOptions options, org.unix4j.util.Range range); 323 /** 324 * Cuts the fields or characters using the given indexes 325 from the input line and writes them to the output. 326 * <p> 327 * Note that the method returns {@code this} builder to allow for command 328 * chaining. The command itself is returned by the {@link #build()} method. 329 * See {@link Unix4jCommandBuilder class comments} for more information. 330 * 331 * @param options options for the cut command 332 * @param indexes select these chars/field based on the given indexes. Indexes are 1 based. i.e. the first character/field on a line has an index of 1. 333 * @return {@code this} builder to allow for method chaining; method 334 * chaining is used here to create command chains; adding a command 335 * to the chain usually means that the previous command <i>pipes</i> 336 * its output to the next command (the pipe symbol in unix) 337 */ 338 @Override 339 Unix4jCommandBuilder cut(CutOptions options, int... indexes); 340 /** 341 * Cuts the fields using the given range 342 from the input line and writes them to the output. 343 * <p> 344 * Note that the method returns {@code this} builder to allow for command 345 * chaining. The command itself is returned by the {@link #build()} method. 346 * See {@link Unix4jCommandBuilder class comments} for more information. 347 * 348 * @param options options for the cut command 349 * @param delimiter use as the output delimiter the default is to use the input delimiter 350 * @param range select only these fields 351 * @return {@code this} builder to allow for method chaining; method 352 * chaining is used here to create command chains; adding a command 353 * to the chain usually means that the previous command <i>pipes</i> 354 * its output to the next command (the pipe symbol in unix) 355 */ 356 @Override 357 Unix4jCommandBuilder cut(CutOptions options, String delimiter, org.unix4j.util.Range range); 358 /** 359 * Cuts the fields using the given indexes 360 from the input line and writes them to the output. 361 * <p> 362 * Note that the method returns {@code this} builder to allow for command 363 * chaining. The command itself is returned by the {@link #build()} method. 364 * See {@link Unix4jCommandBuilder class comments} for more information. 365 * 366 * @param options options for the cut command 367 * @param delimiter use as the output delimiter the default is to use the input delimiter 368 * @param indexes select these chars/field based on the given indexes. Indexes are 1 based. i.e. the first character/field on a line has an index of 1. 369 * @return {@code this} builder to allow for method chaining; method 370 * chaining is used here to create command chains; adding a command 371 * to the chain usually means that the previous command <i>pipes</i> 372 * its output to the next command (the pipe symbol in unix) 373 */ 374 @Override 375 Unix4jCommandBuilder cut(CutOptions options, String delimiter, int... indexes); 376 /** 377 * Cuts the fields using the given range and using the given delimiter 378 from the input line and writes them to the output using the given outputDelimiter. 379 * <p> 380 * Note that the method returns {@code this} builder to allow for command 381 * chaining. The command itself is returned by the {@link #build()} method. 382 * See {@link Unix4jCommandBuilder class comments} for more information. 383 * 384 * @param options options for the cut command 385 * @param delimiter use as the output delimiter the default is to use the input delimiter 386 * @param outputDelimiter use as the output delimiter the default is to use the input delimiter 387 * @param range select only these fields 388 * @return {@code this} builder to allow for method chaining; method 389 * chaining is used here to create command chains; adding a command 390 * to the chain usually means that the previous command <i>pipes</i> 391 * its output to the next command (the pipe symbol in unix) 392 */ 393 @Override 394 Unix4jCommandBuilder cut(CutOptions options, String delimiter, char outputDelimiter, org.unix4j.util.Range range); 395 /** 396 * Cuts the fields using the given indexes and using the given delimiter 397 from the input line and writes them to the output using the given outputDelimiter. 398 * <p> 399 * Note that the method returns {@code this} builder to allow for command 400 * chaining. The command itself is returned by the {@link #build()} method. 401 * See {@link Unix4jCommandBuilder class comments} for more information. 402 * 403 * @param options options for the cut command 404 * @param delimiter use as the output delimiter the default is to use the input delimiter 405 * @param outputDelimiter use as the output delimiter the default is to use the input delimiter 406 * @param indexes select these chars/field based on the given indexes. Indexes are 1 based. i.e. the first character/field on a line has an index of 1. 407 * @return {@code this} builder to allow for method chaining; method 408 * chaining is used here to create command chains; adding a command 409 * to the chain usually means that the previous command <i>pipes</i> 410 * its output to the next command (the pipe symbol in unix) 411 */ 412 @Override 413 Unix4jCommandBuilder cut(CutOptions options, String delimiter, char outputDelimiter, int... indexes); 414 415 /* ------------------ echo ------------------ */ 416 /** 417 * Writes any of the specified strings, separated by single blank 418 ({@code ' '}) characters to the standard output suppressing the 419 trailing line ending if the {@code "-n"} option is specified. 420 * <p> 421 * Note that the method returns {@code this} builder to allow for command 422 * chaining. The command itself is returned by the {@link #build()} method. 423 * See {@link Unix4jCommandBuilder class comments} for more information. 424 * 425 * @param args String arguments defining the options for the command and the 426 strings to be written to the output. Options can be specified by 427 acronym (with a leading dash "-") or by long name (with two leading 428 dashes "--"). 429 * @return {@code this} builder to allow for method chaining; method 430 * chaining is used here to create command chains; adding a command 431 * to the chain usually means that the previous command <i>pipes</i> 432 * its output to the next command (the pipe symbol in unix) 433 */ 434 @Override 435 Unix4jCommandBuilder echo(String... args); 436 /** 437 * Writes the specified string followed by a newline character to 438 the standard output suppressing the trailing line ending if the 439 {@code -n} option is specified. 440 * <p> 441 * Note that the method returns {@code this} builder to allow for command 442 * chaining. The command itself is returned by the {@link #build()} method. 443 * See {@link Unix4jCommandBuilder class comments} for more information. 444 * 445 * @param options Options for the echo command. 446 * @param string A string to be written to standard output. 447 * @return {@code this} builder to allow for method chaining; method 448 * chaining is used here to create command chains; adding a command 449 * to the chain usually means that the previous command <i>pipes</i> 450 * its output to the next command (the pipe symbol in unix) 451 */ 452 @Override 453 Unix4jCommandBuilder echo(EchoOptions options, String string); 454 /** 455 * Writes any of the specified strings, separated by single blank 456 ({@code ' '}) characters to the standard output suppressing the 457 trailing line ending if the {@code -n} option is specified. 458 * <p> 459 * Note that the method returns {@code this} builder to allow for command 460 * chaining. The command itself is returned by the {@link #build()} method. 461 * See {@link Unix4jCommandBuilder class comments} for more information. 462 * 463 * @param options Options for the echo command. 464 * @param strings Strings to be written to standard output, separated by single blank 465 characters. 466 * @return {@code this} builder to allow for method chaining; method 467 * chaining is used here to create command chains; adding a command 468 * to the chain usually means that the previous command <i>pipes</i> 469 * its output to the next command (the pipe symbol in unix) 470 */ 471 @Override 472 Unix4jCommandBuilder echo(EchoOptions options, String... strings); 473 474 /* ------------------ find ------------------ */ 475 /** 476 * Finds all files matching the search criteria specified by the given 477 arguments and writes the file names to the standard output. 478 <p> 479 Options can be specified by acronym (with a leading dash "-") or by 480 long name (with two leading dashes "--"). Operands other than the 481 default "--name" operand have to be prefixed with the operand name. 482 <p> 483 The files names written to the output are relative paths referring 484 to the working directory (or -- if provided -- relative to the path 485 given after the {@code "--path"} operand name). 486 * <p> 487 * Note that the method returns {@code this} builder to allow for command 488 * chaining. The command itself is returned by the {@link #build()} method. 489 * See {@link Unix4jCommandBuilder class comments} for more information. 490 * 491 * @param args String arguments defining the options and operands for the command. 492 Options can be specified by acronym (with a leading dash "-") or by 493 long name (with two leading dashes "--"). Operands other than the 494 default "--path" operand have to be prefixed with the operand name 495 (e.g. "--name" for subsequent path operand values). 496 * @return {@code this} builder to allow for method chaining; method 497 * chaining is used here to create command chains; adding a command 498 * to the chain usually means that the previous command <i>pipes</i> 499 * its output to the next command (the pipe symbol in unix) 500 */ 501 @Override 502 Unix4jCommandBuilder find(String... args); 503 /** 504 * Finds all files in or below the directory specified by {@code path} 505 and writes the file names to the standard output. 506<p> 507 The files names written to the output are paths relative to the 508 specified {@code path} operand. 509 * <p> 510 * Note that the method returns {@code this} builder to allow for command 511 * chaining. The command itself is returned by the {@link #build()} method. 512 * See {@link Unix4jCommandBuilder class comments} for more information. 513 * 514 * @param path Starting point for the search in the directory hierarchy; 515 wildcards * and ? are supported; relative paths are resolved on the 516 basis of the current working directory. 517 * @return {@code this} builder to allow for method chaining; method 518 * chaining is used here to create command chains; adding a command 519 * to the chain usually means that the previous command <i>pipes</i> 520 * its output to the next command (the pipe symbol in unix) 521 */ 522 @Override 523 Unix4jCommandBuilder find(String path); 524 /** 525 * Finds all files matching the specified {@code name} in or below the 526 directory specified by {@code path} and writes the file names to 527 the standard output. 528 <p> 529 The files names written to the output are paths relative to the 530 specified {@code path} operand. 531 * <p> 532 * Note that the method returns {@code this} builder to allow for command 533 * chaining. The command itself is returned by the {@link #build()} method. 534 * See {@link Unix4jCommandBuilder class comments} for more information. 535 * 536 * @param path Starting point for the search in the directory hierarchy; 537 wildcards * and ? are supported; relative paths are resolved on the 538 basis of the current working directory. 539 * @param name Name pattern to match the file name after removing the path with the 540 leading directories; wildcards * and ? are supported, or full 541 regular expressions if either of the options {@code -regex (-r)} or 542 {@code -iregex (-i)} is specified. 543 * @return {@code this} builder to allow for method chaining; method 544 * chaining is used here to create command chains; adding a command 545 * to the chain usually means that the previous command <i>pipes</i> 546 * its output to the next command (the pipe symbol in unix) 547 */ 548 @Override 549 Unix4jCommandBuilder find(String path, String name); 550 /** 551 * Finds all files matching the specified file {@code size} in or below 552 the user's current working directory and writes the file names to 553 the standard output. Matching files use at least {@code size} bytes 554 on disk if {@code size} is positive, or at most {@code abs(size)} 555 bytes if {@code size} is zero or negative. 556 <p> 557 The files names written to the output are relative paths referring 558 to the working directory. 559 * <p> 560 * Note that the method returns {@code this} builder to allow for command 561 * chaining. The command itself is returned by the {@link #build()} method. 562 * See {@link Unix4jCommandBuilder class comments} for more information. 563 * 564 * @param size Consider only files using at least {@code size} bytes if {@code size} 565 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 566 or negative. 567 * @return {@code this} builder to allow for method chaining; method 568 * chaining is used here to create command chains; adding a command 569 * to the chain usually means that the previous command <i>pipes</i> 570 * its output to the next command (the pipe symbol in unix) 571 */ 572 @Override 573 Unix4jCommandBuilder find(long size); 574 /** 575 * Finds all files matching the specified file {@code size} in or below 576 the directory specified by {@code path} and writes the file names 577 to the standard output. Matching files use at least {@code size} 578 bytes on disk if {@code size} is positive, or at most 579 {@code abs(size)} bytes if {@code size} is zero or negative. 580<p> 581 The files names written to the output are paths relative to the 582 specified {@code path} operand. 583 * <p> 584 * Note that the method returns {@code this} builder to allow for command 585 * chaining. The command itself is returned by the {@link #build()} method. 586 * See {@link Unix4jCommandBuilder class comments} for more information. 587 * 588 * @param path Starting point for the search in the directory hierarchy; 589 wildcards * and ? are supported; relative paths are resolved on the 590 basis of the current working directory. 591 * @param size Consider only files using at least {@code size} bytes if {@code size} 592 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 593 or negative. 594 * @return {@code this} builder to allow for method chaining; method 595 * chaining is used here to create command chains; adding a command 596 * to the chain usually means that the previous command <i>pipes</i> 597 * its output to the next command (the pipe symbol in unix) 598 */ 599 @Override 600 Unix4jCommandBuilder find(String path, long size); 601 /** 602 * Finds all files matching the specified file {@code name} and 603 {@code size} in or below the user's current working directory and 604 writes the file names to the standard output. Matching files use 605 at least {@code size} bytes on disk if {@code size} is positive, 606 or at most {@code abs(size)} bytes if {@code size} is zero or 607 negative. 608<p> 609 The files names written to the output are relative paths referring 610 to the working directory. 611 * <p> 612 * Note that the method returns {@code this} builder to allow for command 613 * chaining. The command itself is returned by the {@link #build()} method. 614 * See {@link Unix4jCommandBuilder class comments} for more information. 615 * 616 * @param size Consider only files using at least {@code size} bytes if {@code size} 617 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 618 or negative. 619 * @param name Name pattern to match the file name after removing the path with the 620 leading directories; wildcards * and ? are supported, or full 621 regular expressions if either of the options {@code -regex (-r)} or 622 {@code -iregex (-i)} is specified. 623 * @return {@code this} builder to allow for method chaining; method 624 * chaining is used here to create command chains; adding a command 625 * to the chain usually means that the previous command <i>pipes</i> 626 * its output to the next command (the pipe symbol in unix) 627 */ 628 @Override 629 Unix4jCommandBuilder find(long size, String name); 630 /** 631 * Finds all files matching the specified file {@code name} and 632 {@code size} in or below the directory specified by {@code path} 633 and writes the file names to the standard output. Matching files 634 use at least {@code size} bytes on disk if {@code size} is positive, 635 or at most {@code abs(size)} bytes if {@code size} is zero or 636 negative. 637<p> 638 The files names written to the output are paths relative to the 639 specified {@code path} operand. 640 * <p> 641 * Note that the method returns {@code this} builder to allow for command 642 * chaining. The command itself is returned by the {@link #build()} method. 643 * See {@link Unix4jCommandBuilder class comments} for more information. 644 * 645 * @param path Starting point for the search in the directory hierarchy; 646 wildcards * and ? are supported; relative paths are resolved on the 647 basis of the current working directory. 648 * @param size Consider only files using at least {@code size} bytes if {@code size} 649 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 650 or negative. 651 * @param name Name pattern to match the file name after removing the path with the 652 leading directories; wildcards * and ? are supported, or full 653 regular expressions if either of the options {@code -regex (-r)} or 654 {@code -iregex (-i)} is specified. 655 * @return {@code this} builder to allow for method chaining; method 656 * chaining is used here to create command chains; adding a command 657 * to the chain usually means that the previous command <i>pipes</i> 658 * its output to the next command (the pipe symbol in unix) 659 */ 660 @Override 661 Unix4jCommandBuilder find(String path, long size, String name); 662 /** 663 * Finds all files matching the specified {@code name} in or below the 664 user's current working directory and writes the file names to the 665 standard output. 666 <p> 667 The files names written to the output are relative paths referring 668 to the working directory. 669 * <p> 670 * Note that the method returns {@code this} builder to allow for command 671 * chaining. The command itself is returned by the {@link #build()} method. 672 * See {@link Unix4jCommandBuilder class comments} for more information. 673 * 674 * @param options Options for the file search. 675 * @param name Name pattern to match the file name after removing the path with the 676 leading directories; wildcards * and ? are supported, or full 677 regular expressions if either of the options {@code -regex (-r)} or 678 {@code -iregex (-i)} is specified. 679 * @return {@code this} builder to allow for method chaining; method 680 * chaining is used here to create command chains; adding a command 681 * to the chain usually means that the previous command <i>pipes</i> 682 * its output to the next command (the pipe symbol in unix) 683 */ 684 @Override 685 Unix4jCommandBuilder find(FindOptions options, String name); 686 /** 687 * Finds all files matching the specified {@code name} in or below the 688 directory specified by {@code path} and writes the file names to 689 the standard output. 690<p> 691 The files names written to the output are paths relative to the 692 specified {@code path} operand. 693 * <p> 694 * Note that the method returns {@code this} builder to allow for command 695 * chaining. The command itself is returned by the {@link #build()} method. 696 * See {@link Unix4jCommandBuilder class comments} for more information. 697 * 698 * @param options Options for the file search. 699 * @param path Starting point for the search in the directory hierarchy; 700 wildcards * and ? are supported; relative paths are resolved on the 701 basis of the current working directory. 702 * @param name Name pattern to match the file name after removing the path with the 703 leading directories; wildcards * and ? are supported, or full 704 regular expressions if either of the options {@code -regex (-r)} or 705 {@code -iregex (-i)} is specified. 706 * @return {@code this} builder to allow for method chaining; method 707 * chaining is used here to create command chains; adding a command 708 * to the chain usually means that the previous command <i>pipes</i> 709 * its output to the next command (the pipe symbol in unix) 710 */ 711 @Override 712 Unix4jCommandBuilder find(FindOptions options, String path, String name); 713 /** 714 * Finds all files matching the specified file {@code size} in or below 715 the user's current working directory and writes the file names to 716 the standard output. Matching files use at least {@code size} bytes 717 on disk if {@code size} is positive, or at most {@code abs(size)} 718 bytes if {@code size} is zero or negative. 719<p> 720 The files names written to the output are relative paths referring 721 to the working directory. 722 * <p> 723 * Note that the method returns {@code this} builder to allow for command 724 * chaining. The command itself is returned by the {@link #build()} method. 725 * See {@link Unix4jCommandBuilder class comments} for more information. 726 * 727 * @param options Options for the file search. 728 * @param size Consider only files using at least {@code size} bytes if {@code size} 729 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 730 or negative. 731 * @return {@code this} builder to allow for method chaining; method 732 * chaining is used here to create command chains; adding a command 733 * to the chain usually means that the previous command <i>pipes</i> 734 * its output to the next command (the pipe symbol in unix) 735 */ 736 @Override 737 Unix4jCommandBuilder find(FindOptions options, long size); 738 /** 739 * Finds all files matching the specified file {@code size} in or below 740 the directory specified by {@code path} and writes the file names 741 to the standard output. Matching files use at least {@code size} 742 bytes on disk if {@code size} is positive, or at most 743 {@code abs(size)} bytes if {@code size} is zero or negative. 744<p> 745 The files names written to the output are paths relative to the 746 specified {@code path} operand. 747 * <p> 748 * Note that the method returns {@code this} builder to allow for command 749 * chaining. The command itself is returned by the {@link #build()} method. 750 * See {@link Unix4jCommandBuilder class comments} for more information. 751 * 752 * @param options Options for the file search. 753 * @param path Starting point for the search in the directory hierarchy; 754 wildcards * and ? are supported; relative paths are resolved on the 755 basis of the current working directory. 756 * @param size Consider only files using at least {@code size} bytes if {@code size} 757 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 758 or negative. 759 * @return {@code this} builder to allow for method chaining; method 760 * chaining is used here to create command chains; adding a command 761 * to the chain usually means that the previous command <i>pipes</i> 762 * its output to the next command (the pipe symbol in unix) 763 */ 764 @Override 765 Unix4jCommandBuilder find(FindOptions options, String path, long size); 766 /** 767 * Finds all files that have been created, modified or accessed before 768 or after the specified {@code time} (depending on the given 769 {@code -time...} options). The names of the matching files found in 770 or below the user's current working directory are written to the 771 standard output. 772<p> 773 The files names written to the output are relative paths referring 774 to the working directory. 775 * <p> 776 * Note that the method returns {@code this} builder to allow for command 777 * chaining. The command itself is returned by the {@link #build()} method. 778 * See {@link Unix4jCommandBuilder class comments} for more information. 779 * 780 * @param options Options for the file search. 781 * @param time Consider only files that have been created, modified or accessed 782 before or after the specified {@code time} operand; consider the 783 {@code -time...} options for details of the comparison. 784 * @return {@code this} builder to allow for method chaining; method 785 * chaining is used here to create command chains; adding a command 786 * to the chain usually means that the previous command <i>pipes</i> 787 * its output to the next command (the pipe symbol in unix) 788 */ 789 @Override 790 Unix4jCommandBuilder find(FindOptions options, java.util.Date time); 791 /** 792 * Finds all files that have been created, modified or accessed before 793 or after the specified {@code time} (depending on the given 794 {@code -time...} options). The names of the matching files found in 795 or below the directory specified by {@code path} are written to 796 the standard output. 797<p> 798 The files names written to the output are paths relative to the 799 specified {@code path} operand. 800 * <p> 801 * Note that the method returns {@code this} builder to allow for command 802 * chaining. The command itself is returned by the {@link #build()} method. 803 * See {@link Unix4jCommandBuilder class comments} for more information. 804 * 805 * @param options Options for the file search. 806 * @param path Starting point for the search in the directory hierarchy; 807 wildcards * and ? are supported; relative paths are resolved on the 808 basis of the current working directory. 809 * @param time Consider only files that have been created, modified or accessed 810 before or after the specified {@code time} operand; consider the 811 {@code -time...} options for details of the comparison. 812 * @return {@code this} builder to allow for method chaining; method 813 * chaining is used here to create command chains; adding a command 814 * to the chain usually means that the previous command <i>pipes</i> 815 * its output to the next command (the pipe symbol in unix) 816 */ 817 @Override 818 Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time); 819 /** 820 * Finds all files matching the specified file {@code name} and 821 {@code size} in or below the user's current working directory and 822 writes the file names to the standard output. Matching files use 823 at least {@code size} bytes on disk if {@code size} is positive, or 824 at most {@code abs(size)} bytes if {@code size} is zero or negative. 825<p> 826 The files names written to the output are relative paths referring 827 to the working directory. 828 * <p> 829 * Note that the method returns {@code this} builder to allow for command 830 * chaining. The command itself is returned by the {@link #build()} method. 831 * See {@link Unix4jCommandBuilder class comments} for more information. 832 * 833 * @param options Options for the file search. 834 * @param size Consider only files using at least {@code size} bytes if {@code size} 835 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 836 or negative. 837 * @param name Name pattern to match the file name after removing the path with the 838 leading directories; wildcards * and ? are supported, or full 839 regular expressions if either of the options {@code -regex (-r)} or 840 {@code -iregex (-i)} is specified. 841 * @return {@code this} builder to allow for method chaining; method 842 * chaining is used here to create command chains; adding a command 843 * to the chain usually means that the previous command <i>pipes</i> 844 * its output to the next command (the pipe symbol in unix) 845 */ 846 @Override 847 Unix4jCommandBuilder find(FindOptions options, long size, String name); 848 /** 849 * Finds all files matching the specified file {@code name} and 850 {@code size} in or below the directory specified by {@code path} 851 and writes the file names to the standard output. Matching files 852 use at least {@code size} bytes on disk if {@code size} is positive, 853 or at most {@code abs(size)} bytes if {@code size} is zero or 854 negative. 855<p> 856 The files names written to the output are paths relative to the 857 specified {@code path} operand. 858 * <p> 859 * Note that the method returns {@code this} builder to allow for command 860 * chaining. The command itself is returned by the {@link #build()} method. 861 * See {@link Unix4jCommandBuilder class comments} for more information. 862 * 863 * @param options Options for the file search. 864 * @param path Starting point for the search in the directory hierarchy; 865 wildcards * and ? are supported; relative paths are resolved on the 866 basis of the current working directory. 867 * @param size Consider only files using at least {@code size} bytes if {@code size} 868 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 869 or negative. 870 * @param name Name pattern to match the file name after removing the path with the 871 leading directories; wildcards * and ? are supported, or full 872 regular expressions if either of the options {@code -regex (-r)} or 873 {@code -iregex (-i)} is specified. 874 * @return {@code this} builder to allow for method chaining; method 875 * chaining is used here to create command chains; adding a command 876 * to the chain usually means that the previous command <i>pipes</i> 877 * its output to the next command (the pipe symbol in unix) 878 */ 879 @Override 880 Unix4jCommandBuilder find(FindOptions options, String path, long size, String name); 881 /** 882 * Finds all files matching the given {@code name} that have been 883 created, modified or accessed before or after the specified 884 {@code time} (depending on the given {@code -time...} options). The 885 names of the matching files found in or below the user's current 886 working directory are written to the standard output. 887<p> 888 The files names written to the output are relative paths referring 889 to the working directory. 890 * <p> 891 * Note that the method returns {@code this} builder to allow for command 892 * chaining. The command itself is returned by the {@link #build()} method. 893 * See {@link Unix4jCommandBuilder class comments} for more information. 894 * 895 * @param options Options for the file search. 896 * @param time Consider only files that have been created, modified or accessed 897 before or after the specified {@code time} operand; consider the 898 {@code -time...} options for details of the comparison. 899 * @param name Name pattern to match the file name after removing the path with the 900 leading directories; wildcards * and ? are supported, or full 901 regular expressions if either of the options {@code -regex (-r)} or 902 {@code -iregex (-i)} is specified. 903 * @return {@code this} builder to allow for method chaining; method 904 * chaining is used here to create command chains; adding a command 905 * to the chain usually means that the previous command <i>pipes</i> 906 * its output to the next command (the pipe symbol in unix) 907 */ 908 @Override 909 Unix4jCommandBuilder find(FindOptions options, java.util.Date time, String name); 910 /** 911 * Finds all files matching the given {@code name} that have been 912 created, modified or accessed before or after the specified 913 {@code time} (depending on the given {@code -time...} options). The 914 names of the matching files found in or below the directory 915 specified by {@code path} are written to the standard output. 916<p> 917 The files names written to the output are paths relative to the 918 specified {@code path} operand. 919 * <p> 920 * Note that the method returns {@code this} builder to allow for command 921 * chaining. The command itself is returned by the {@link #build()} method. 922 * See {@link Unix4jCommandBuilder class comments} for more information. 923 * 924 * @param options Options for the file search. 925 * @param path Starting point for the search in the directory hierarchy; 926 wildcards * and ? are supported; relative paths are resolved on the 927 basis of the current working directory. 928 * @param time Consider only files that have been created, modified or accessed 929 before or after the specified {@code time} operand; consider the 930 {@code -time...} options for details of the comparison. 931 * @param name Name pattern to match the file name after removing the path with the 932 leading directories; wildcards * and ? are supported, or full 933 regular expressions if either of the options {@code -regex (-r)} or 934 {@code -iregex (-i)} is specified. 935 * @return {@code this} builder to allow for method chaining; method 936 * chaining is used here to create command chains; adding a command 937 * to the chain usually means that the previous command <i>pipes</i> 938 * its output to the next command (the pipe symbol in unix) 939 */ 940 @Override 941 Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time, String name); 942 /** 943 * Finds all files matching the given {@code name} and {@code size} and 944 have been created, modified or accessed before or after the specified 945 {@code time} (depending on the given {@code -time...} options). 946 <p> 947 Matching files use at least {@code size} bytes on disk if 948 {@code size} is positive, or at most {@code abs(size)} bytes if 949 {@code size} is zero or negative. The names of the matching files 950 found in or below the user's current working directory are written 951 to the standard output. 952<p> 953 The files names written to the output are relative paths referring 954 to the working directory. 955 * <p> 956 * Note that the method returns {@code this} builder to allow for command 957 * chaining. The command itself is returned by the {@link #build()} method. 958 * See {@link Unix4jCommandBuilder class comments} for more information. 959 * 960 * @param options Options for the file search. 961 * @param size Consider only files using at least {@code size} bytes if {@code size} 962 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 963 or negative. 964 * @param time Consider only files that have been created, modified or accessed 965 before or after the specified {@code time} operand; consider the 966 {@code -time...} options for details of the comparison. 967 * @param name Name pattern to match the file name after removing the path with the 968 leading directories; wildcards * and ? are supported, or full 969 regular expressions if either of the options {@code -regex (-r)} or 970 {@code -iregex (-i)} is specified. 971 * @return {@code this} builder to allow for method chaining; method 972 * chaining is used here to create command chains; adding a command 973 * to the chain usually means that the previous command <i>pipes</i> 974 * its output to the next command (the pipe symbol in unix) 975 */ 976 @Override 977 Unix4jCommandBuilder find(FindOptions options, long size, java.util.Date time, String name); 978 /** 979 * Finds all files matching the given {@code name} and {@code size} and 980 have been created, modified or accessed before or after the specified 981 {@code time} (depending on the given {@code -time...} options). 982 <p> 983 Matching files use at least {@code size} bytes on disk if 984 {@code size} is positive, or at most {@code abs(size)} bytes if 985 {@code size} is zero or negative. The names of the matching files 986 found in or below the directory specified by {@code path} are 987 written to the standard output. 988<p> 989 The files names written to the output are paths relative to the 990 specified {@code path} operand. 991 * <p> 992 * Note that the method returns {@code this} builder to allow for command 993 * chaining. The command itself is returned by the {@link #build()} method. 994 * See {@link Unix4jCommandBuilder class comments} for more information. 995 * 996 * @param options Options for the file search. 997 * @param path Starting point for the search in the directory hierarchy; 998 wildcards * and ? are supported; relative paths are resolved on the 999 basis of the current working directory. 1000 * @param size Consider only files using at least {@code size} bytes if {@code size} 1001 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 1002 or negative. 1003 * @param time Consider only files that have been created, modified or accessed 1004 before or after the specified {@code time} operand; consider the 1005 {@code -time...} options for details of the comparison. 1006 * @param name Name pattern to match the file name after removing the path with the 1007 leading directories; wildcards * and ? are supported, or full 1008 regular expressions if either of the options {@code -regex (-r)} or 1009 {@code -iregex (-i)} is specified. 1010 * @return {@code this} builder to allow for method chaining; method 1011 * chaining is used here to create command chains; adding a command 1012 * to the chain usually means that the previous command <i>pipes</i> 1013 * its output to the next command (the pipe symbol in unix) 1014 */ 1015 @Override 1016 Unix4jCommandBuilder find(FindOptions options, String path, long size, java.util.Date time, String name); 1017 1018 /* ------------------ from ------------------ */ 1019 /** 1020 * Uses the given string as input for the next command. If the string 1021 contains line ending codes (UNIX or DOS independent from the host 1022 operating system), the string is split into multiple lines. 1023 * <p> 1024 * Note that the method returns {@code this} builder to allow for command 1025 * chaining. The command itself is returned by the {@link #build()} method. 1026 * See {@link Unix4jCommandBuilder class comments} for more information. 1027 * 1028 * @param string the string to use as input 1029 * @return {@code this} builder to allow for method chaining; method 1030 * chaining is used here to create command chains; adding a command 1031 * to the chain usually means that the previous command <i>pipes</i> 1032 * its output to the next command (the pipe symbol in unix) 1033 */ 1034 @Override 1035 Unix4jCommandBuilder fromString(String string); 1036 /** 1037 * Uses the given strings as input for the next command. Each string 1038 usually represents a single line of the input; however, if any of 1039 the strings contains line ending codes (UNIX or DOS independent from 1040 the host operating system), it is split into multiple lines. 1041 * <p> 1042 * Note that the method returns {@code this} builder to allow for command 1043 * chaining. The command itself is returned by the {@link #build()} method. 1044 * See {@link Unix4jCommandBuilder class comments} for more information. 1045 * 1046 * @param strings the input lines 1047 * @return {@code this} builder to allow for method chaining; method 1048 * chaining is used here to create command chains; adding a command 1049 * to the chain usually means that the previous command <i>pipes</i> 1050 * its output to the next command (the pipe symbol in unix) 1051 */ 1052 @Override 1053 Unix4jCommandBuilder fromStrings(String... strings); 1054 /** 1055 * Uses the strings in the specified {@code input} iterable as input 1056 lines for the next command. Each string usually represents a single 1057 line of the input; however, if any of the strings contains line 1058 ending codes (UNIX or DOS independent from the host operating 1059 system), it is split into multiple lines. 1060 * <p> 1061 * Note that the method returns {@code this} builder to allow for command 1062 * chaining. The command itself is returned by the {@link #build()} method. 1063 * See {@link Unix4jCommandBuilder class comments} for more information. 1064 * 1065 * @param lines collection with input lines 1066 * @return {@code this} builder to allow for method chaining; method 1067 * chaining is used here to create command chains; adding a command 1068 * to the chain usually means that the previous command <i>pipes</i> 1069 * its output to the next command (the pipe symbol in unix) 1070 */ 1071 @Override 1072 Unix4jCommandBuilder from(Iterable<? extends String> lines); 1073 /** 1074 * Uses the strings returned by the specified iterator as input 1075 lines for the next command. Each string usually represents a single 1076 line of the input; however, if any of the strings contains line 1077 ending codes (UNIX or DOS independent from the host operating 1078 system), it is split into multiple lines. 1079 * <p> 1080 * Note that the method returns {@code this} builder to allow for command 1081 * chaining. The command itself is returned by the {@link #build()} method. 1082 * See {@link Unix4jCommandBuilder class comments} for more information. 1083 * 1084 * @param iterator iterator returning input lines 1085 * @return {@code this} builder to allow for method chaining; method 1086 * chaining is used here to create command chains; adding a command 1087 * to the chain usually means that the previous command <i>pipes</i> 1088 * its output to the next command (the pipe symbol in unix) 1089 */ 1090 @Override 1091 Unix4jCommandBuilder from(java.util.Iterator<? extends String> iterator); 1092 /** 1093 * Uses the strings returned by the specified stream as input 1094 lines for the next command. Each string usually represents a single 1095 line of the input; however, if any of the strings contains line 1096 ending codes (UNIX or DOS independent from the host operating 1097 system), it is split into multiple lines. 1098 * <p> 1099 * Note that the method returns {@code this} builder to allow for command 1100 * chaining. The command itself is returned by the {@link #build()} method. 1101 * See {@link Unix4jCommandBuilder class comments} for more information. 1102 * 1103 * @param stream stream of input lines 1104 * @return {@code this} builder to allow for method chaining; method 1105 * chaining is used here to create command chains; adding a command 1106 * to the chain usually means that the previous command <i>pipes</i> 1107 * its output to the next command (the pipe symbol in unix) 1108 */ 1109 @Override 1110 Unix4jCommandBuilder from(java.util.stream.Stream<? extends String> stream); 1111 /** 1112 * Redirects the contents of the given file into the next command. This 1113 is essentially equivalent to the following syntax in a unix command 1114 shell: {@code path > ...} 1115 * <p> 1116 * Note that the method returns {@code this} builder to allow for command 1117 * chaining. The command itself is returned by the {@link #build()} method. 1118 * See {@link Unix4jCommandBuilder class comments} for more information. 1119 * 1120 * @param path the file to use as input; wildcards * and ? are supported; relative 1121 paths are resolved on the basis of the current working directory. 1122 * @return {@code this} builder to allow for method chaining; method 1123 * chaining is used here to create command chains; adding a command 1124 * to the chain usually means that the previous command <i>pipes</i> 1125 * its output to the next command (the pipe symbol in unix) 1126 */ 1127 @Override 1128 Unix4jCommandBuilder fromFile(String path); 1129 /** 1130 * Redirects the contents of the given file into the next command. This 1131 is essentially equivalent to the following syntax in a unix command 1132 shell: {@code file > ...} 1133 * <p> 1134 * Note that the method returns {@code this} builder to allow for command 1135 * chaining. The command itself is returned by the {@link #build()} method. 1136 * See {@link Unix4jCommandBuilder class comments} for more information. 1137 * 1138 * @param file the file to use as input; relative paths are not resolved (use the 1139 string path argument to enable relative path resolving based on the 1140 current working directory). 1141 * @return {@code this} builder to allow for method chaining; method 1142 * chaining is used here to create command chains; adding a command 1143 * to the chain usually means that the previous command <i>pipes</i> 1144 * its output to the next command (the pipe symbol in unix) 1145 */ 1146 @Override 1147 Unix4jCommandBuilder fromFile(java.io.File file); 1148 /** 1149 * Reads from the given resource relative to the classpath and 1150 redirects the contents into the next command. The resource is 1151 usually a file or URL on the classpath. The resource is read using 1152 {@link Class#getResourceAsStream(String)}. 1153 * <p> 1154 * Note that the method returns {@code this} builder to allow for command 1155 * chaining. The command itself is returned by the {@link #build()} method. 1156 * See {@link Unix4jCommandBuilder class comments} for more information. 1157 * 1158 * @param resource a path to the file to redirect to the next command. The resource needs 1159 to be on the classpath. If the file is in the root directory, the 1160 filename should be prefixed with a forward slash. e.g.: 1161 {@code "/test-file.txt"}. 1162 <p> 1163 If the file is in a package, then the package should be specified 1164 prefixed with a forward slash, and with each dot "." replaced with a 1165 forward slash. e.g.: 1166 {@code "/org/company/mypackage/test-file.txt"}. 1167 A {@code base} class operand can be provided for relative paths; see 1168 {@link java.lang.Class#getResourceAsStream(String)} for details about 1169 resource loading. 1170 * @return {@code this} builder to allow for method chaining; method 1171 * chaining is used here to create command chains; adding a command 1172 * to the chain usually means that the previous command <i>pipes</i> 1173 * its output to the next command (the pipe symbol in unix) 1174 */ 1175 @Override 1176 Unix4jCommandBuilder fromResource(String resource); 1177 /** 1178 * Reads from the given resource relative to the classpath and 1179 redirects the contents into the next command. The resource is 1180 usually a file or URL on the classpath. The resource is read using 1181 {@link Class#getResourceAsStream(String)}. 1182 * <p> 1183 * Note that the method returns {@code this} builder to allow for command 1184 * chaining. The command itself is returned by the {@link #build()} method. 1185 * See {@link Unix4jCommandBuilder class comments} for more information. 1186 * 1187 * @param base base class for subsequent {@code resource} operand if relative paths are used. 1188 * @param resource a path to the file to redirect to the next command. The resource needs 1189 to be on the classpath. If the file is in the root directory, the 1190 filename should be prefixed with a forward slash. e.g.: 1191 {@code "/test-file.txt"}. 1192 <p> 1193 If the file is in a package, then the package should be specified 1194 prefixed with a forward slash, and with each dot "." replaced with a 1195 forward slash. e.g.: 1196 {@code "/org/company/mypackage/test-file.txt"}. 1197 A {@code base} class operand can be provided for relative paths; see 1198 {@link java.lang.Class#getResourceAsStream(String)} for details about 1199 resource loading. 1200 * @return {@code this} builder to allow for method chaining; method 1201 * chaining is used here to create command chains; adding a command 1202 * to the chain usually means that the previous command <i>pipes</i> 1203 * its output to the next command (the pipe symbol in unix) 1204 */ 1205 @Override 1206 Unix4jCommandBuilder fromResource(Class<?> base, String resource); 1207 /** 1208 * Reads from the given input stream and redirects the contents into 1209 the next command. 1210 * <p> 1211 * Note that the method returns {@code this} builder to allow for command 1212 * chaining. The command itself is returned by the {@link #build()} method. 1213 * See {@link Unix4jCommandBuilder class comments} for more information. 1214 * 1215 * @param in the input stream to read from 1216 * @return {@code this} builder to allow for method chaining; method 1217 * chaining is used here to create command chains; adding a command 1218 * to the chain usually means that the previous command <i>pipes</i> 1219 * its output to the next command (the pipe symbol in unix) 1220 */ 1221 @Override 1222 Unix4jCommandBuilder from(java.io.InputStream in); 1223 /** 1224 * Uses the given reader and redirects the read input into the next 1225 command. 1226 * <p> 1227 * Note that the method returns {@code this} builder to allow for command 1228 * chaining. The command itself is returned by the {@link #build()} method. 1229 * See {@link Unix4jCommandBuilder class comments} for more information. 1230 * 1231 * @param reader the reader used to read the input 1232 * @return {@code this} builder to allow for method chaining; method 1233 * chaining is used here to create command chains; adding a command 1234 * to the chain usually means that the previous command <i>pipes</i> 1235 * its output to the next command (the pipe symbol in unix) 1236 */ 1237 @Override 1238 Unix4jCommandBuilder from(java.io.Reader reader); 1239 /** 1240 * Reads from the given URL and redirects the contents into the next 1241 command. 1242 * <p> 1243 * Note that the method returns {@code this} builder to allow for command 1244 * chaining. The command itself is returned by the {@link #build()} method. 1245 * See {@link Unix4jCommandBuilder class comments} for more information. 1246 * 1247 * @param url the URL to read from 1248 * @return {@code this} builder to allow for method chaining; method 1249 * chaining is used here to create command chains; adding a command 1250 * to the chain usually means that the previous command <i>pipes</i> 1251 * its output to the next command (the pipe symbol in unix) 1252 */ 1253 @Override 1254 Unix4jCommandBuilder from(java.net.URL url); 1255 /** 1256 * Reads from the given input object and redirects the contents into 1257 the next command. 1258 * <p> 1259 * Note that the method returns {@code this} builder to allow for command 1260 * chaining. The command itself is returned by the {@link #build()} method. 1261 * See {@link Unix4jCommandBuilder class comments} for more information. 1262 * 1263 * @param input the input object to read from 1264 * @return {@code this} builder to allow for method chaining; method 1265 * chaining is used here to create command chains; adding a command 1266 * to the chain usually means that the previous command <i>pipes</i> 1267 * its output to the next command (the pipe symbol in unix) 1268 */ 1269 @Override 1270 Unix4jCommandBuilder from(org.unix4j.io.Input input); 1271 1272 /* ------------------ grep ------------------ */ 1273 /** 1274 * Filters the input lines from the standard input or the provided 1275 input files and writes the matching lines to the standard output. A 1276 line matches if it contains the given {@code "--regexp"} operand 1277 value (default operand). 1278 <p> 1279 Options can be specified by acronym (with a leading dash "-") or by 1280 long name (with two leading dashes "--"). Operands other than the 1281 default "--regexp" and "--paths" operands have to be prefixed with 1282 the operand name. 1283 * <p> 1284 * Note that the method returns {@code this} builder to allow for command 1285 * chaining. The command itself is returned by the {@link #build()} method. 1286 * See {@link Unix4jCommandBuilder class comments} for more information. 1287 * 1288 * @param args String arguments defining the options and operands for the command. 1289 Options can be specified by acronym (with a leading dash "-") or by 1290 long name (with two leading dashes "--"). Operands other than the 1291 default "--pattern" and "--paths" operands have to be prefixed with 1292 the operand name (e.g. "--files" for subsequent file operand values). 1293 * @return {@code this} builder to allow for method chaining; method 1294 * chaining is used here to create command chains; adding a command 1295 * to the chain usually means that the previous command <i>pipes</i> 1296 * its output to the next command (the pipe symbol in unix) 1297 */ 1298 @Override 1299 Unix4jCommandBuilder grep(String... args); 1300 /** 1301 * Filters the input lines from the standard input and writes the 1302 matching lines to the standard output. A line matches if it contains 1303 the given {@code regexp} using case-sensitive string comparison. 1304 * <p> 1305 * Note that the method returns {@code this} builder to allow for command 1306 * chaining. The command itself is returned by the {@link #build()} method. 1307 * See {@link Unix4jCommandBuilder class comments} for more information. 1308 * 1309 * @param regexp Lines will be printed which match the given regular expression. The 1310 {@code regexp} string is surrounded with ".*" on both sides unless 1311 the {@code --wholeLine} option is specified. If the 1312 {@code --fixedStrings} option is used, plain string comparison is 1313 used instead of regular expression matching. 1314 * @return {@code this} builder to allow for method chaining; method 1315 * chaining is used here to create command chains; adding a command 1316 * to the chain usually means that the previous command <i>pipes</i> 1317 * its output to the next command (the pipe symbol in unix) 1318 */ 1319 @Override 1320 Unix4jCommandBuilder grep(String regexp); 1321 /** 1322 * Filters the lines from the specified input files and writes the 1323 matching lines to the standard output. Every line is matched against 1324 the given {@code regexp} string using case-sensitive comparison. 1325 Line endings are not relevant for the comparison. 1326 * <p> 1327 * Note that the method returns {@code this} builder to allow for command 1328 * chaining. The command itself is returned by the {@link #build()} method. 1329 * See {@link Unix4jCommandBuilder class comments} for more information. 1330 * 1331 * @param regexp Lines will be printed which match the given regular expression. The 1332 {@code regexp} string is surrounded with ".*" on both sides unless 1333 the {@code --wholeLine} option is specified. If the 1334 {@code --fixedStrings} option is used, plain string comparison is 1335 used instead of regular expression matching. 1336 * @param files The input files to be searched for the pattern; relative paths are 1337 not resolved (use the string paths argument to enable relative path 1338 resolving based on the current working directory). 1339 * @return {@code this} builder to allow for method chaining; method 1340 * chaining is used here to create command chains; adding a command 1341 * to the chain usually means that the previous command <i>pipes</i> 1342 * its output to the next command (the pipe symbol in unix) 1343 */ 1344 @Override 1345 Unix4jCommandBuilder grep(String regexp, java.io.File... files); 1346 /** 1347 * Filters the lines from the specified inputs and writes the 1348 matching lines to the standard output. Every line is matched against 1349 the given {@code regexp} string using case-sensitive comparison. 1350 Line endings are not relevant for the comparison. 1351 * <p> 1352 * Note that the method returns {@code this} builder to allow for command 1353 * chaining. The command itself is returned by the {@link #build()} method. 1354 * See {@link Unix4jCommandBuilder class comments} for more information. 1355 * 1356 * @param regexp Lines will be printed which match the given regular expression. The 1357 {@code regexp} string is surrounded with ".*" on both sides unless 1358 the {@code --wholeLine} option is specified. If the 1359 {@code --fixedStrings} option is used, plain string comparison is 1360 used instead of regular expression matching. 1361 * @param inputs The inputs to be searched for the pattern. 1362 * @return {@code this} builder to allow for method chaining; method 1363 * chaining is used here to create command chains; adding a command 1364 * to the chain usually means that the previous command <i>pipes</i> 1365 * its output to the next command (the pipe symbol in unix) 1366 */ 1367 @Override 1368 Unix4jCommandBuilder grep(String regexp, org.unix4j.io.Input... inputs); 1369 /** 1370 * Filters the input lines from the standard input and writes the 1371 matching lines to the standard output. Every line is matched against 1372 the given regular expression {@code pattern} using case-sensitive 1373 comparison. Line endings are not relevant for the comparison. 1374 * <p> 1375 * Note that the method returns {@code this} builder to allow for command 1376 * chaining. The command itself is returned by the {@link #build()} method. 1377 * See {@link Unix4jCommandBuilder class comments} for more information. 1378 * 1379 * @param pattern Lines will be printed which match the given pattern. 1380 * @return {@code this} builder to allow for method chaining; method 1381 * chaining is used here to create command chains; adding a command 1382 * to the chain usually means that the previous command <i>pipes</i> 1383 * its output to the next command (the pipe symbol in unix) 1384 */ 1385 @Override 1386 Unix4jCommandBuilder grep(java.util.regex.Pattern pattern); 1387 /** 1388 * Filters the lines from the specified input files and writes the 1389 matching lines to the standard output. Every line is matched against 1390 the given regular expression {@code pattern} using case-sensitive 1391 comparison. Line endings are not relevant for the comparison. 1392 * <p> 1393 * Note that the method returns {@code this} builder to allow for command 1394 * chaining. The command itself is returned by the {@link #build()} method. 1395 * See {@link Unix4jCommandBuilder class comments} for more information. 1396 * 1397 * @param pattern Lines will be printed which match the given pattern. 1398 * @param files The input files to be searched for the pattern; relative paths are 1399 not resolved (use the string paths argument to enable relative path 1400 resolving based on the current working directory). 1401 * @return {@code this} builder to allow for method chaining; method 1402 * chaining is used here to create command chains; adding a command 1403 * to the chain usually means that the previous command <i>pipes</i> 1404 * its output to the next command (the pipe symbol in unix) 1405 */ 1406 @Override 1407 Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, java.io.File... files); 1408 /** 1409 * Filters the lines from the specified input files and writes the 1410 matching lines to the standard output. Every line is matched against 1411 the given regular expression {@code pattern} using case-sensitive 1412 comparison. Line endings are not relevant for the comparison. 1413 * <p> 1414 * Note that the method returns {@code this} builder to allow for command 1415 * chaining. The command itself is returned by the {@link #build()} method. 1416 * See {@link Unix4jCommandBuilder class comments} for more information. 1417 * 1418 * @param pattern Lines will be printed which match the given pattern. 1419 * @param paths Path names of the input files to be searched for the pattern; 1420 wildcards * and ? are supported; relative paths are resolved on the 1421 basis of the current working directory. 1422 * @return {@code this} builder to allow for method chaining; method 1423 * chaining is used here to create command chains; adding a command 1424 * to the chain usually means that the previous command <i>pipes</i> 1425 * its output to the next command (the pipe symbol in unix) 1426 */ 1427 @Override 1428 Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, String... paths); 1429 /** 1430 * Filters the lines from the specified inputs and writes the 1431 matching lines to the standard output. Every line is matched against 1432 the given regular expression {@code pattern} using case-sensitive 1433 comparison. Line endings are not relevant for the comparison. 1434 * <p> 1435 * Note that the method returns {@code this} builder to allow for command 1436 * chaining. The command itself is returned by the {@link #build()} method. 1437 * See {@link Unix4jCommandBuilder class comments} for more information. 1438 * 1439 * @param pattern Lines will be printed which match the given pattern. 1440 * @param inputs The inputs to be searched for the pattern. 1441 * @return {@code this} builder to allow for method chaining; method 1442 * chaining is used here to create command chains; adding a command 1443 * to the chain usually means that the previous command <i>pipes</i> 1444 * its output to the next command (the pipe symbol in unix) 1445 */ 1446 @Override 1447 Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, org.unix4j.io.Input... inputs); 1448 /** 1449 * Filters the input lines from the standard input and writes the 1450 matching lines to the standard output. Every line is matched against 1451 the given {@code regexp} string; the exact comparison rules are 1452 defined by the specified matching {@code options}. 1453 * <p> 1454 * Note that the method returns {@code this} builder to allow for command 1455 * chaining. The command itself is returned by the {@link #build()} method. 1456 * See {@link Unix4jCommandBuilder class comments} for more information. 1457 * 1458 * @param options The options defining the types of patterns and command behavior. 1459 * @param regexp Lines will be printed which match the given regular expression. The 1460 {@code regexp} string is surrounded with ".*" on both sides unless 1461 the {@code --wholeLine} option is specified. If the 1462 {@code --fixedStrings} option is used, plain string comparison is 1463 used instead of regular expression matching. 1464 * @return {@code this} builder to allow for method chaining; method 1465 * chaining is used here to create command chains; adding a command 1466 * to the chain usually means that the previous command <i>pipes</i> 1467 * its output to the next command (the pipe symbol in unix) 1468 */ 1469 @Override 1470 Unix4jCommandBuilder grep(GrepOptions options, String regexp); 1471 /** 1472 * Filters the input lines from the standard input and writes the 1473 matching lines to the standard output. Every line is matched against 1474 the given regular expression {@code pattern}; the exact comparison 1475 rules are defined by the specified matching {@code options}. 1476 * <p> 1477 * Note that the method returns {@code this} builder to allow for command 1478 * chaining. The command itself is returned by the {@link #build()} method. 1479 * See {@link Unix4jCommandBuilder class comments} for more information. 1480 * 1481 * @param options The options defining the types of patterns and command behavior. 1482 * @param pattern Lines will be printed which match the given pattern. 1483 * @return {@code this} builder to allow for method chaining; method 1484 * chaining is used here to create command chains; adding a command 1485 * to the chain usually means that the previous command <i>pipes</i> 1486 * its output to the next command (the pipe symbol in unix) 1487 */ 1488 @Override 1489 Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern); 1490 /** 1491 * Filters the input lines from the specified input files and writes 1492 the matching lines to the standard output. Every line is matched 1493 against the given {@code regexp} string; the exact comparison rules 1494 are defined by the specified matching {@code options}. 1495 * <p> 1496 * Note that the method returns {@code this} builder to allow for command 1497 * chaining. The command itself is returned by the {@link #build()} method. 1498 * See {@link Unix4jCommandBuilder class comments} for more information. 1499 * 1500 * @param options The options defining the types of patterns and command behavior. 1501 * @param regexp Lines will be printed which match the given regular expression. The 1502 {@code regexp} string is surrounded with ".*" on both sides unless 1503 the {@code --wholeLine} option is specified. If the 1504 {@code --fixedStrings} option is used, plain string comparison is 1505 used instead of regular expression matching. 1506 * @param files The input files to be searched for the pattern; relative paths are 1507 not resolved (use the string paths argument to enable relative path 1508 resolving based on the current working directory). 1509 * @return {@code this} builder to allow for method chaining; method 1510 * chaining is used here to create command chains; adding a command 1511 * to the chain usually means that the previous command <i>pipes</i> 1512 * its output to the next command (the pipe symbol in unix) 1513 */ 1514 @Override 1515 Unix4jCommandBuilder grep(GrepOptions options, String regexp, java.io.File... files); 1516 /** 1517 * Filters the input lines from the specified input files and writes 1518 the matching lines to the standard output. Every line is matched 1519 against the given {@code regexp} string; the exact comparison rules 1520 are defined by the specified matching {@code options}. 1521 * <p> 1522 * Note that the method returns {@code this} builder to allow for command 1523 * chaining. The command itself is returned by the {@link #build()} method. 1524 * See {@link Unix4jCommandBuilder class comments} for more information. 1525 * 1526 * @param options The options defining the types of patterns and command behavior. 1527 * @param regexp Lines will be printed which match the given regular expression. The 1528 {@code regexp} string is surrounded with ".*" on both sides unless 1529 the {@code --wholeLine} option is specified. If the 1530 {@code --fixedStrings} option is used, plain string comparison is 1531 used instead of regular expression matching. 1532 * @param paths Path names of the input files to be searched for the pattern; 1533 wildcards * and ? are supported; relative paths are resolved on the 1534 basis of the current working directory. 1535 * @return {@code this} builder to allow for method chaining; method 1536 * chaining is used here to create command chains; adding a command 1537 * to the chain usually means that the previous command <i>pipes</i> 1538 * its output to the next command (the pipe symbol in unix) 1539 */ 1540 @Override 1541 Unix4jCommandBuilder grep(GrepOptions options, String regexp, String... paths); 1542 /** 1543 * Filters the input lines from the specified inputs and writes 1544 the matching lines to the standard output. Every line is matched 1545 against the given {@code regexp} string; the exact comparison rules 1546 are defined by the specified matching {@code options}. 1547 * <p> 1548 * Note that the method returns {@code this} builder to allow for command 1549 * chaining. The command itself is returned by the {@link #build()} method. 1550 * See {@link Unix4jCommandBuilder class comments} for more information. 1551 * 1552 * @param options The options defining the types of patterns and command behavior. 1553 * @param regexp Lines will be printed which match the given regular expression. The 1554 {@code regexp} string is surrounded with ".*" on both sides unless 1555 the {@code --wholeLine} option is specified. If the 1556 {@code --fixedStrings} option is used, plain string comparison is 1557 used instead of regular expression matching. 1558 * @param inputs The inputs to be searched for the pattern. 1559 * @return {@code this} builder to allow for method chaining; method 1560 * chaining is used here to create command chains; adding a command 1561 * to the chain usually means that the previous command <i>pipes</i> 1562 * its output to the next command (the pipe symbol in unix) 1563 */ 1564 @Override 1565 Unix4jCommandBuilder grep(GrepOptions options, String regexp, org.unix4j.io.Input... inputs); 1566 /** 1567 * Filters the input lines from the specified input files and writes 1568 the matching lines to the standard output. Every line is matched 1569 against the given regular expression {@code pattern}; the exact 1570 comparison rules are defined by the specified matching 1571 {@code options}. 1572 * <p> 1573 * Note that the method returns {@code this} builder to allow for command 1574 * chaining. The command itself is returned by the {@link #build()} method. 1575 * See {@link Unix4jCommandBuilder class comments} for more information. 1576 * 1577 * @param options The options defining the types of patterns and command behavior. 1578 * @param pattern Lines will be printed which match the given pattern. 1579 * @param files The input files to be searched for the pattern; relative paths are 1580 not resolved (use the string paths argument to enable relative path 1581 resolving based on the current working directory). 1582 * @return {@code this} builder to allow for method chaining; method 1583 * chaining is used here to create command chains; adding a command 1584 * to the chain usually means that the previous command <i>pipes</i> 1585 * its output to the next command (the pipe symbol in unix) 1586 */ 1587 @Override 1588 Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, java.io.File... files); 1589 /** 1590 * Filters the input lines from the specified input files and writes 1591 the matching lines to the standard output. Every line is matched 1592 against the given regular expression {@code pattern}; the exact 1593 comparison rules are defined by the specified matching 1594 {@code options}. 1595 * <p> 1596 * Note that the method returns {@code this} builder to allow for command 1597 * chaining. The command itself is returned by the {@link #build()} method. 1598 * See {@link Unix4jCommandBuilder class comments} for more information. 1599 * 1600 * @param options The options defining the types of patterns and command behavior. 1601 * @param pattern Lines will be printed which match the given pattern. 1602 * @param paths Path names of the input files to be searched for the pattern; 1603 wildcards * and ? are supported; relative paths are resolved on the 1604 basis of the current working directory. 1605 * @return {@code this} builder to allow for method chaining; method 1606 * chaining is used here to create command chains; adding a command 1607 * to the chain usually means that the previous command <i>pipes</i> 1608 * its output to the next command (the pipe symbol in unix) 1609 */ 1610 @Override 1611 Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, String... paths); 1612 /** 1613 * Filters the input lines from the specified inputs and writes 1614 the matching lines to the standard output. Every line is matched 1615 against the given regular expression {@code pattern}; the exact 1616 comparison rules are defined by the specified matching 1617 {@code options}. 1618 * <p> 1619 * Note that the method returns {@code this} builder to allow for command 1620 * chaining. The command itself is returned by the {@link #build()} method. 1621 * See {@link Unix4jCommandBuilder class comments} for more information. 1622 * 1623 * @param options The options defining the types of patterns and command behavior. 1624 * @param pattern Lines will be printed which match the given pattern. 1625 * @param inputs The inputs to be searched for the pattern. 1626 * @return {@code this} builder to allow for method chaining; method 1627 * chaining is used here to create command chains; adding a command 1628 * to the chain usually means that the previous command <i>pipes</i> 1629 * its output to the next command (the pipe symbol in unix) 1630 */ 1631 @Override 1632 Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, org.unix4j.io.Input... inputs); 1633 1634 /* ------------------ head ------------------ */ 1635 /** 1636 * Reads the first 10 lines from the standard input and writes them to 1637 the standard output. 1638 * <p> 1639 * Note that the method returns {@code this} builder to allow for command 1640 * chaining. The command itself is returned by the {@link #build()} method. 1641 * See {@link Unix4jCommandBuilder class comments} for more information. 1642 * 1643 * @return {@code this} builder to allow for method chaining; method 1644 * chaining is used here to create command chains; adding a command 1645 * to the chain usually means that the previous command <i>pipes</i> 1646 * its output to the next command (the pipe symbol in unix) 1647 */ 1648 @Override 1649 Unix4jCommandBuilder head(); 1650 /** 1651 * Reads the first n lines from each of the files specified and writes 1652 them to the standard output. If more than a single file is 1653 specified, each file is preceded by a header consisting of the 1654 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1655 of the file. 1656<p> 1657 Options can be specified by acronym (with a leading dash "-") or by 1658 long name (with two leading dashes "--"). Operands other than the 1659 default "--paths" operand have to be prefixed with the operand 1660 name. 1661 * <p> 1662 * Note that the method returns {@code this} builder to allow for command 1663 * chaining. The command itself is returned by the {@link #build()} method. 1664 * See {@link Unix4jCommandBuilder class comments} for more information. 1665 * 1666 * @param args String arguments defining the options and operands for the command. 1667 Options can be specified by acronym (with a leading dash "-") or by 1668 long name (with two leading dashes "--"). Operands other than the 1669 default "--paths" operand have to be prefixed with the operand 1670 name (e.g. "--count" for a subsequent count operand value). 1671 * @return {@code this} builder to allow for method chaining; method 1672 * chaining is used here to create command chains; adding a command 1673 * to the chain usually means that the previous command <i>pipes</i> 1674 * its output to the next command (the pipe symbol in unix) 1675 */ 1676 @Override 1677 Unix4jCommandBuilder head(String... args); 1678 /** 1679 * Reads the first {@code count} lines from the standard input and 1680 writes them to the standard output. 1681 * <p> 1682 * Note that the method returns {@code this} builder to allow for command 1683 * chaining. The command itself is returned by the {@link #build()} method. 1684 * See {@link Unix4jCommandBuilder class comments} for more information. 1685 * 1686 * @param count The first {@code count} lines of each input file are 1687 copied to standard output, starting from 1 (characters instead of 1688 lines if the {@code -c} option is specified). Must be a non-negative 1689 integer or an exception is thrown. If {@code count} is greater than 1690 the number number of lines (characters) in the input, the 1691 application will not error and send the whole file to the output. 1692 * @return {@code this} builder to allow for method chaining; method 1693 * chaining is used here to create command chains; adding a command 1694 * to the chain usually means that the previous command <i>pipes</i> 1695 * its output to the next command (the pipe symbol in unix) 1696 */ 1697 @Override 1698 Unix4jCommandBuilder head(long count); 1699 /** 1700 * Reads the first {@code count} lines or characters from the standard 1701 input and writes them to the standard output. 1702 * <p> 1703 * Note that the method returns {@code this} builder to allow for command 1704 * chaining. The command itself is returned by the {@link #build()} method. 1705 * See {@link Unix4jCommandBuilder class comments} for more information. 1706 * 1707 * @param options Options for the head command. 1708 * @param count The first {@code count} lines of each input file are 1709 copied to standard output, starting from 1 (characters instead of 1710 lines if the {@code -c} option is specified). Must be a non-negative 1711 integer or an exception is thrown. If {@code count} is greater than 1712 the number number of lines (characters) in the input, the 1713 application will not error and send the whole file to the output. 1714 * @return {@code this} builder to allow for method chaining; method 1715 * chaining is used here to create command chains; adding a command 1716 * to the chain usually means that the previous command <i>pipes</i> 1717 * its output to the next command (the pipe symbol in unix) 1718 */ 1719 @Override 1720 Unix4jCommandBuilder head(HeadOptions options, long count); 1721 /** 1722 * Reads the first 10 lines from each of the specified files and writes 1723 them to the standard output. If more than a single file is 1724 specified, each file is preceded by a header consisting of the 1725 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1726 of the file. 1727 * <p> 1728 * Note that the method returns {@code this} builder to allow for command 1729 * chaining. The command itself is returned by the {@link #build()} method. 1730 * See {@link Unix4jCommandBuilder class comments} for more information. 1731 * 1732 * @param files The input files to be filtered; relative paths are not resolved (use 1733 the string paths argument to enable relative path resolving based on 1734 the current working directory). 1735 * @return {@code this} builder to allow for method chaining; method 1736 * chaining is used here to create command chains; adding a command 1737 * to the chain usually means that the previous command <i>pipes</i> 1738 * its output to the next command (the pipe symbol in unix) 1739 */ 1740 @Override 1741 Unix4jCommandBuilder head(java.io.File... files); 1742 /** 1743 * Reads the first 10 lines from each of the specified inputs and writes 1744 them to the standard output. If more than a input is 1745 specified, each file is preceded by a header consisting of the 1746 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 1747 string representation. 1748 * <p> 1749 * Note that the method returns {@code this} builder to allow for command 1750 * chaining. The command itself is returned by the {@link #build()} method. 1751 * See {@link Unix4jCommandBuilder class comments} for more information. 1752 * 1753 * @param inputs The inputs to be filtered. 1754 * @return {@code this} builder to allow for method chaining; method 1755 * chaining is used here to create command chains; adding a command 1756 * to the chain usually means that the previous command <i>pipes</i> 1757 * its output to the next command (the pipe symbol in unix) 1758 */ 1759 @Override 1760 Unix4jCommandBuilder head(org.unix4j.io.Input... inputs); 1761 /** 1762 * Reads the first {@code count} lines from each of the specified files 1763 and writes them to the standard output. If more than a single file 1764 is specified, each file is preceded by a header consisting of the 1765 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1766 of the file. 1767 * <p> 1768 * Note that the method returns {@code this} builder to allow for command 1769 * chaining. The command itself is returned by the {@link #build()} method. 1770 * See {@link Unix4jCommandBuilder class comments} for more information. 1771 * 1772 * @param count The first {@code count} lines of each input file are 1773 copied to standard output, starting from 1 (characters instead of 1774 lines if the {@code -c} option is specified). Must be a non-negative 1775 integer or an exception is thrown. If {@code count} is greater than 1776 the number number of lines (characters) in the input, the 1777 application will not error and send the whole file to the output. 1778 * @param files The input files to be filtered; relative paths are not resolved (use 1779 the string paths argument to enable relative path resolving based on 1780 the current working directory). 1781 * @return {@code this} builder to allow for method chaining; method 1782 * chaining is used here to create command chains; adding a command 1783 * to the chain usually means that the previous command <i>pipes</i> 1784 * its output to the next command (the pipe symbol in unix) 1785 */ 1786 @Override 1787 Unix4jCommandBuilder head(long count, java.io.File... files); 1788 /** 1789 * Reads the first {@code count} lines from each of the specified files 1790 and writes them to the standard output. If more than a single file 1791 is specified, each file is preceded by a header consisting of the 1792 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1793 of the file. 1794 * <p> 1795 * Note that the method returns {@code this} builder to allow for command 1796 * chaining. The command itself is returned by the {@link #build()} method. 1797 * See {@link Unix4jCommandBuilder class comments} for more information. 1798 * 1799 * @param count The first {@code count} lines of each input file are 1800 copied to standard output, starting from 1 (characters instead of 1801 lines if the {@code -c} option is specified). Must be a non-negative 1802 integer or an exception is thrown. If {@code count} is greater than 1803 the number number of lines (characters) in the input, the 1804 application will not error and send the whole file to the output. 1805 * @param paths Path names of the input files to be filtered; wildcards * and ? are 1806 supported; relative paths are resolved on the basis of the current 1807 working directory. 1808 * @return {@code this} builder to allow for method chaining; method 1809 * chaining is used here to create command chains; adding a command 1810 * to the chain usually means that the previous command <i>pipes</i> 1811 * its output to the next command (the pipe symbol in unix) 1812 */ 1813 @Override 1814 Unix4jCommandBuilder head(long count, String... paths); 1815 /** 1816 * Reads the first {@code count} lines from each of the specified inputs 1817 and writes them to the standard output. If more than a single input 1818 is specified, each file is preceded by a header consisting of the 1819 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 1820 string representation. 1821 * <p> 1822 * Note that the method returns {@code this} builder to allow for command 1823 * chaining. The command itself is returned by the {@link #build()} method. 1824 * See {@link Unix4jCommandBuilder class comments} for more information. 1825 * 1826 * @param count The first {@code count} lines of each input file are 1827 copied to standard output, starting from 1 (characters instead of 1828 lines if the {@code -c} option is specified). Must be a non-negative 1829 integer or an exception is thrown. If {@code count} is greater than 1830 the number number of lines (characters) in the input, the 1831 application will not error and send the whole file to the output. 1832 * @param inputs The inputs to be filtered. 1833 * @return {@code this} builder to allow for method chaining; method 1834 * chaining is used here to create command chains; adding a command 1835 * to the chain usually means that the previous command <i>pipes</i> 1836 * its output to the next command (the pipe symbol in unix) 1837 */ 1838 @Override 1839 Unix4jCommandBuilder head(long count, org.unix4j.io.Input... inputs); 1840 /** 1841 * Reads the first {@code count} lines or characters from each of the 1842 specified files and writes them to the standard output. If more than 1843 a single file is specified and the {@code -q} option is not 1844 specified, each file is preceded by a header consisting of the 1845 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1846 of the file. 1847 * <p> 1848 * Note that the method returns {@code this} builder to allow for command 1849 * chaining. The command itself is returned by the {@link #build()} method. 1850 * See {@link Unix4jCommandBuilder class comments} for more information. 1851 * 1852 * @param options Options for the head command. 1853 * @param count The first {@code count} lines of each input file are 1854 copied to standard output, starting from 1 (characters instead of 1855 lines if the {@code -c} option is specified). Must be a non-negative 1856 integer or an exception is thrown. If {@code count} is greater than 1857 the number number of lines (characters) in the input, the 1858 application will not error and send the whole file to the output. 1859 * @param files The input files to be filtered; relative paths are not resolved (use 1860 the string paths argument to enable relative path resolving based on 1861 the current working directory). 1862 * @return {@code this} builder to allow for method chaining; method 1863 * chaining is used here to create command chains; adding a command 1864 * to the chain usually means that the previous command <i>pipes</i> 1865 * its output to the next command (the pipe symbol in unix) 1866 */ 1867 @Override 1868 Unix4jCommandBuilder head(HeadOptions options, long count, java.io.File... files); 1869 /** 1870 * Reads the first {@code count} lines or characters from each of the 1871 specified files and writes them to the standard output. If more than 1872 a single file is specified and the {@code -q} option is not 1873 specified, each file is preceded by a header consisting of the 1874 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1875 of the file. 1876 * <p> 1877 * Note that the method returns {@code this} builder to allow for command 1878 * chaining. The command itself is returned by the {@link #build()} method. 1879 * See {@link Unix4jCommandBuilder class comments} for more information. 1880 * 1881 * @param options Options for the head command. 1882 * @param count The first {@code count} lines of each input file are 1883 copied to standard output, starting from 1 (characters instead of 1884 lines if the {@code -c} option is specified). Must be a non-negative 1885 integer or an exception is thrown. If {@code count} is greater than 1886 the number number of lines (characters) in the input, the 1887 application will not error and send the whole file to the output. 1888 * @param paths Path names of the input files to be filtered; wildcards * and ? are 1889 supported; relative paths are resolved on the basis of the current 1890 working directory. 1891 * @return {@code this} builder to allow for method chaining; method 1892 * chaining is used here to create command chains; adding a command 1893 * to the chain usually means that the previous command <i>pipes</i> 1894 * its output to the next command (the pipe symbol in unix) 1895 */ 1896 @Override 1897 Unix4jCommandBuilder head(HeadOptions options, long count, String... paths); 1898 /** 1899 * Reads the first {@code count} lines or characters from each of the 1900 specified inputs and writes them to the standard output. If more than 1901 a single input is specified and the {@code -q} option is not 1902 specified, each file is preceded by a header consisting of the 1903 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 1904 string representation. 1905 * <p> 1906 * Note that the method returns {@code this} builder to allow for command 1907 * chaining. The command itself is returned by the {@link #build()} method. 1908 * See {@link Unix4jCommandBuilder class comments} for more information. 1909 * 1910 * @param options Options for the head command. 1911 * @param count The first {@code count} lines of each input file are 1912 copied to standard output, starting from 1 (characters instead of 1913 lines if the {@code -c} option is specified). Must be a non-negative 1914 integer or an exception is thrown. If {@code count} is greater than 1915 the number number of lines (characters) in the input, the 1916 application will not error and send the whole file to the output. 1917 * @param inputs The inputs to be filtered. 1918 * @return {@code this} builder to allow for method chaining; method 1919 * chaining is used here to create command chains; adding a command 1920 * to the chain usually means that the previous command <i>pipes</i> 1921 * its output to the next command (the pipe symbol in unix) 1922 */ 1923 @Override 1924 Unix4jCommandBuilder head(HeadOptions options, long count, org.unix4j.io.Input... inputs); 1925 1926 /* ------------------ ls ------------------ */ 1927 /** 1928 * Lists all files and directories in the user's current working 1929 directory and writes them to the output. 1930 * <p> 1931 * Note that the method returns {@code this} builder to allow for command 1932 * chaining. The command itself is returned by the {@link #build()} method. 1933 * See {@link Unix4jCommandBuilder class comments} for more information. 1934 * 1935 * @return {@code this} builder to allow for method chaining; method 1936 * chaining is used here to create command chains; adding a command 1937 * to the chain usually means that the previous command <i>pipes</i> 1938 * its output to the next command (the pipe symbol in unix) 1939 */ 1940 @Override 1941 Unix4jCommandBuilder ls(); 1942 /** 1943 * Prints the name of the specified files and lists all files contained 1944 in directories for every directory in those files. 1945 <p> 1946 Options can be specified by acronym (with a leading dash "-") or by 1947 long name (with two leading dashes "--"). Operands other than the 1948 default "--paths" operand have to be prefixed with the operand 1949 name. 1950 * <p> 1951 * Note that the method returns {@code this} builder to allow for command 1952 * chaining. The command itself is returned by the {@link #build()} method. 1953 * See {@link Unix4jCommandBuilder class comments} for more information. 1954 * 1955 * @param args String arguments defining the options and operands for the command. 1956 Options can be specified by acronym (with a leading dash "-") or by 1957 long name (with two leading dashes "--"). Operands other than the 1958 default "--paths" operand have to be prefixed with the operand 1959 name (e.g. "--count" for a subsequent count operand value). 1960 * @return {@code this} builder to allow for method chaining; method 1961 * chaining is used here to create command chains; adding a command 1962 * to the chain usually means that the previous command <i>pipes</i> 1963 * its output to the next command (the pipe symbol in unix) 1964 */ 1965 @Override 1966 Unix4jCommandBuilder ls(String... args); 1967 /** 1968 * Prints the name of the given files and lists all files contained in 1969 directories for every directory in {@code files}. 1970 * <p> 1971 * Note that the method returns {@code this} builder to allow for command 1972 * chaining. The command itself is returned by the {@link #build()} method. 1973 * See {@link Unix4jCommandBuilder class comments} for more information. 1974 * 1975 * @param files The files or directories used as starting point for the listing; 1976 relative paths are not resolved (use the string path argument to 1977 enable relative path resolving based on the current working 1978 directory). 1979 * @return {@code this} builder to allow for method chaining; method 1980 * chaining is used here to create command chains; adding a command 1981 * to the chain usually means that the previous command <i>pipes</i> 1982 * its output to the next command (the pipe symbol in unix) 1983 */ 1984 @Override 1985 Unix4jCommandBuilder ls(java.io.File... files); 1986 /** 1987 * Lists all files and directories in the user's current working 1988 directory and writes them to the output using the given options 1989 specifying the details of the output format. 1990 * <p> 1991 * Note that the method returns {@code this} builder to allow for command 1992 * chaining. The command itself is returned by the {@link #build()} method. 1993 * See {@link Unix4jCommandBuilder class comments} for more information. 1994 * 1995 * @param options The options defining the output format. 1996 * @return {@code this} builder to allow for method chaining; method 1997 * chaining is used here to create command chains; adding a command 1998 * to the chain usually means that the previous command <i>pipes</i> 1999 * its output to the next command (the pipe symbol in unix) 2000 */ 2001 @Override 2002 Unix4jCommandBuilder ls(LsOptions options); 2003 /** 2004 * Prints the name of the given files and lists all files contained in 2005 directories for every directory in {@code files}. The given options 2006 define the details of the output format. 2007 * <p> 2008 * Note that the method returns {@code this} builder to allow for command 2009 * chaining. The command itself is returned by the {@link #build()} method. 2010 * See {@link Unix4jCommandBuilder class comments} for more information. 2011 * 2012 * @param options The options defining the output format. 2013 * @param files The files or directories used as starting point for the listing; 2014 relative paths are not resolved (use the string path argument to 2015 enable relative path resolving based on the current working 2016 directory). 2017 * @return {@code this} builder to allow for method chaining; method 2018 * chaining is used here to create command chains; adding a command 2019 * to the chain usually means that the previous command <i>pipes</i> 2020 * its output to the next command (the pipe symbol in unix) 2021 */ 2022 @Override 2023 Unix4jCommandBuilder ls(LsOptions options, java.io.File... files); 2024 /** 2025 * Prints the name of the given files and lists all files contained in 2026 directories for every directory in {@code files}. The given options 2027 define the details of the output format. 2028 * <p> 2029 * Note that the method returns {@code this} builder to allow for command 2030 * chaining. The command itself is returned by the {@link #build()} method. 2031 * See {@link Unix4jCommandBuilder class comments} for more information. 2032 * 2033 * @param options The options defining the output format. 2034 * @param paths The files or directories used as starting point for the listing; 2035 wildcards * and ? are supported; relative paths are resolved on the 2036 basis of the current working directory. 2037 * @return {@code this} builder to allow for method chaining; method 2038 * chaining is used here to create command chains; adding a command 2039 * to the chain usually means that the previous command <i>pipes</i> 2040 * its output to the next command (the pipe symbol in unix) 2041 */ 2042 @Override 2043 Unix4jCommandBuilder ls(LsOptions options, String... paths); 2044 2045 /* ------------------ sed ------------------ */ 2046 /** 2047 * Executes the sed script specified by the given arguments and writes 2048 the result to the standard output. 2049 <p> 2050 Options can be specified by acronym (with a leading dash "-") or by 2051 long name (with two leading dashes "--"). Operands other than the 2052 default "--script" operand have to be prefixed with the operand name. 2053 * <p> 2054 * Note that the method returns {@code this} builder to allow for command 2055 * chaining. The command itself is returned by the {@link #build()} method. 2056 * See {@link Unix4jCommandBuilder class comments} for more information. 2057 * 2058 * @param args String arguments defining the options and operands for the command. 2059 Options can be specified by acronym (with a leading dash "-") or by 2060 long name (with two leading dashes "--"). Operands other than the 2061 default "--script" operand have to be prefixed with the operand name 2062 (e.g. "--occurrence" for subsequent occurrence indices). 2063 * @return {@code this} builder to allow for method chaining; method 2064 * chaining is used here to create command chains; adding a command 2065 * to the chain usually means that the previous command <i>pipes</i> 2066 * its output to the next command (the pipe symbol in unix) 2067 */ 2068 @Override 2069 Unix4jCommandBuilder sed(String... args); 2070 /** 2071 * Executes the given sed script, such as "s/original/replacement/g". 2072 * <p> 2073 * Note that the method returns {@code this} builder to allow for command 2074 * chaining. The command itself is returned by the {@link #build()} method. 2075 * See {@link Unix4jCommandBuilder class comments} for more information. 2076 * 2077 * @param script Sed script as one string, such as "s/original/replacement/g". 2078 * @return {@code this} builder to allow for method chaining; method 2079 * chaining is used here to create command chains; adding a command 2080 * to the chain usually means that the previous command <i>pipes</i> 2081 * its output to the next command (the pipe symbol in unix) 2082 */ 2083 @Override 2084 Unix4jCommandBuilder sed(String script); 2085 /** 2086 * Substitutes the replacement string for instances of the regexp in 2087 the matched line. 2088 <p> 2089 The characters "$0" appearing in the replacement are replaced 2090 by the line matching the regexp. The characters "$n", where n is a 2091 digit other than zero, are replaced by the text matched by the 2092 corresponding backreference expression (aka group). The special 2093 meaning of "$n" in this context can be suppressed by preceding it 2094 by a backslash. 2095<p> 2096 A line can be split by substituting a newline ('\n') into it. 2097 <p> 2098 A substitution is considered to have been performed even if the 2099 replacement string is identical to the string that it replaces. 2100 * <p> 2101 * Note that the method returns {@code this} builder to allow for command 2102 * chaining. The command itself is returned by the {@link #build()} method. 2103 * See {@link Unix4jCommandBuilder class comments} for more information. 2104 * 2105 * @param regexp Regular expression matched against a line. 2106 * @param replacement Replacement string for substitute command. The characters "$0" 2107 appearing in the replacement are replaced by the line matching 2108 the regexp. The characters "$n", where n is a digit other than zero, 2109 are replaced by the text matched by the corresponding backreference 2110 expression (aka group). The special meaning of "$n" in this context 2111 can be suppressed by preceding it by a backslash. 2112 * @return {@code this} builder to allow for method chaining; method 2113 * chaining is used here to create command chains; adding a command 2114 * to the chain usually means that the previous command <i>pipes</i> 2115 * its output to the next command (the pipe symbol in unix) 2116 */ 2117 @Override 2118 Unix4jCommandBuilder sed(String regexp, String replacement); 2119 /** 2120 * Substitutes the replacement string for instances of the regexp in 2121 the matched line. Only the given occurrences of the regexp found 2122 within the matched string are substituted. 2123<p> 2124 The characters "$0" appearing in the replacement are replaced 2125 by the line matching the regexp. The characters "$n", where n is a 2126 digit other than zero, are replaced by the text matched by the 2127 corresponding backreference expression (aka group). The special 2128 meaning of "$n" in this context can be suppressed by preceding it 2129 by a backslash. 2130<p> 2131 A line can be split by substituting a newline ('\n') into it. 2132 <p> 2133 A substitution is considered to have been performed even if the 2134 replacement string is identical to the string that it replaces. 2135 * <p> 2136 * Note that the method returns {@code this} builder to allow for command 2137 * chaining. The command itself is returned by the {@link #build()} method. 2138 * See {@link Unix4jCommandBuilder class comments} for more information. 2139 * 2140 * @param regexp Regular expression matched against a line. 2141 * @param replacement Replacement string for substitute command. The characters "$0" 2142 appearing in the replacement are replaced by the line matching 2143 the regexp. The characters "$n", where n is a digit other than zero, 2144 are replaced by the text matched by the corresponding backreference 2145 expression (aka group). The special meaning of "$n" in this context 2146 can be suppressed by preceding it by a backslash. 2147 * @param occurrence Substitute for the given occurrences only of the regexp found within 2148 the matched string; the occurrence indices are one-based. If empty 2149 or omitted, all occurrences are substituted. 2150 <p> 2151 (This operand only applies to the substitute command and is ignored 2152 by all other commands). 2153 * @return {@code this} builder to allow for method chaining; method 2154 * chaining is used here to create command chains; adding a command 2155 * to the chain usually means that the previous command <i>pipes</i> 2156 * its output to the next command (the pipe symbol in unix) 2157 */ 2158 @Override 2159 Unix4jCommandBuilder sed(String regexp, String replacement, int... occurrence); 2160 /** 2161 * Executes the sed command specified by the given options or executes 2162 the print command p if no command option has been declared. 2163 * <p> 2164 * Note that the method returns {@code this} builder to allow for command 2165 * chaining. The command itself is returned by the {@link #build()} method. 2166 * See {@link Unix4jCommandBuilder class comments} for more information. 2167 * 2168 * @param options Sed options and commands 2169 * @param regexp Regular expression matched against a line. 2170 * @return {@code this} builder to allow for method chaining; method 2171 * chaining is used here to create command chains; adding a command 2172 * to the chain usually means that the previous command <i>pipes</i> 2173 * its output to the next command (the pipe symbol in unix) 2174 */ 2175 @Override 2176 Unix4jCommandBuilder sed(SedOptions options, String regexp); 2177 /** 2178 * Executes the sed command specified by the given options or executes 2179 the substitute command s if no command option has been declared. 2180 * <p> 2181 * Note that the method returns {@code this} builder to allow for command 2182 * chaining. The command itself is returned by the {@link #build()} method. 2183 * See {@link Unix4jCommandBuilder class comments} for more information. 2184 * 2185 * @param options Sed options and commands 2186 * @param string1 Regular expression matched against a line for all commands except 2187 for command y where string1 contains the source characters for the 2188 translation. 2189 * @param string2 Replacement string for substitute command s; appended, inserted or 2190 changed text for a, i and c command; destination characters for 2191 translate command y; ignored by all other commands. 2192 <p> 2193 If string2 is a replacement string for the substitute command: the 2194 characters "$0" appearing in the replacement are replaced 2195 by the line matching the regexp; the characters "$n", where n is a 2196 digit other than zero, are replaced by the text matched by the 2197 corresponding backreference expression (aka group). The special 2198 meaning of "$n" in this context can be suppressed by preceding it 2199 by a backslash. 2200<p> 2201 (This operand only applies to the commands s, a, i, c and y and is 2202 ignored by all other commands). 2203 * @return {@code this} builder to allow for method chaining; method 2204 * chaining is used here to create command chains; adding a command 2205 * to the chain usually means that the previous command <i>pipes</i> 2206 * its output to the next command (the pipe symbol in unix) 2207 */ 2208 @Override 2209 Unix4jCommandBuilder sed(SedOptions options, String string1, String string2); 2210 /** 2211 * Executes the sed command specified by the given options or executes 2212 the substitute command s if no command option has been declared. 2213 <p> 2214 The string1 operand usually contains the regular expression matched 2215 against a line for all commands except for command y where string1 2216 contains the source characters for the translation. 2217 <p> 2218 The string2 operand contains the replacement string for the 2219 substitute command s. It contains the appended, inserted or changed 2220 text for the commands a, i and c, respectively, and the destination 2221 characters for the translate command y. All other commands ignore 2222 the string2 operand. 2223 * <p> 2224 * Note that the method returns {@code this} builder to allow for command 2225 * chaining. The command itself is returned by the {@link #build()} method. 2226 * See {@link Unix4jCommandBuilder class comments} for more information. 2227 * 2228 * @param options Sed options and commands 2229 * @param string1 Regular expression matched against a line for all commands except 2230 for command y where string1 contains the source characters for the 2231 translation. 2232 * @param string2 Replacement string for substitute command s; appended, inserted or 2233 changed text for a, i and c command; destination characters for 2234 translate command y; ignored by all other commands. 2235 <p> 2236 If string2 is a replacement string for the substitute command: the 2237 characters "$0" appearing in the replacement are replaced 2238 by the line matching the regexp; the characters "$n", where n is a 2239 digit other than zero, are replaced by the text matched by the 2240 corresponding backreference expression (aka group). The special 2241 meaning of "$n" in this context can be suppressed by preceding it 2242 by a backslash. 2243<p> 2244 (This operand only applies to the commands s, a, i, c and y and is 2245 ignored by all other commands). 2246 * @param occurrence Substitute for the given occurrences only of the regexp found within 2247 the matched string; the occurrence indices are one-based. If empty 2248 or omitted, all occurrences are substituted. 2249 <p> 2250 (This operand only applies to the substitute command and is ignored 2251 by all other commands). 2252 * @return {@code this} builder to allow for method chaining; method 2253 * chaining is used here to create command chains; adding a command 2254 * to the chain usually means that the previous command <i>pipes</i> 2255 * its output to the next command (the pipe symbol in unix) 2256 */ 2257 @Override 2258 Unix4jCommandBuilder sed(SedOptions options, String string1, String string2, int... occurrence); 2259 2260 /* ------------------ sort ------------------ */ 2261 /** 2262 * Sort the lines read from the standard input and writes the result to 2263 the standard output. 2264 <p> 2265 Comparisons are based on the entire line without line ending. The 2266 collating sequence of the current locale is used to perform the 2267 comparisons. 2268 <p> 2269 The sort algorithm used is guaranteed to be stable: lines considered 2270 equal will not be reordered as a result of the sort. 2271 * <p> 2272 * Note that the method returns {@code this} builder to allow for command 2273 * chaining. The command itself is returned by the {@link #build()} method. 2274 * See {@link Unix4jCommandBuilder class comments} for more information. 2275 * 2276 * @return {@code this} builder to allow for method chaining; method 2277 * chaining is used here to create command chains; adding a command 2278 * to the chain usually means that the previous command <i>pipes</i> 2279 * its output to the next command (the pipe symbol in unix) 2280 */ 2281 @Override 2282 Unix4jCommandBuilder sort(); 2283 /** 2284 * Sort the lines of all the specified files together and writes the 2285 result to the standard output. 2286 <p> 2287 Options can be specified by acronym (with a leading dash "-") or by 2288 long name (with two leading dashes "--"). Operands other than the 2289 default "--paths" operand have to be prefixed with the operand 2290 name. 2291 <p> 2292 The sort algorithm used is guaranteed to be stable: lines considered 2293 equal will not be reordered as a result of the sort. If two lines 2294 originate from different input files, the index of the file in the 2295 input arguments list defines the ordering of the lines. 2296 * <p> 2297 * Note that the method returns {@code this} builder to allow for command 2298 * chaining. The command itself is returned by the {@link #build()} method. 2299 * See {@link Unix4jCommandBuilder class comments} for more information. 2300 * 2301 * @param args String arguments defining the options and operands for the command. 2302 Options can be specified by acronym (with a leading dash "-") or by 2303 long name (with two leading dashes "--"). Operands other than the 2304 default "--paths" operand have to be prefixed with the operand 2305 name (e.g. "--comparator" for a subsequent comparator operand value). 2306 * @return {@code this} builder to allow for method chaining; method 2307 * chaining is used here to create command chains; adding a command 2308 * to the chain usually means that the previous command <i>pipes</i> 2309 * its output to the next command (the pipe symbol in unix) 2310 */ 2311 @Override 2312 Unix4jCommandBuilder sort(String... args); 2313 /** 2314 * Sort the lines of all the specified files together and writes the 2315 result to the standard output. 2316<p> 2317 Comparisons are based on the entire line without line ending. The 2318 collating sequence of the current locale is used to perform the 2319 comparisons. 2320<p> 2321 The sort algorithm used is guaranteed to be stable: lines considered 2322 equal will not be reordered as a result of the sort. If two lines 2323 originate from different input files, the index of the file in the 2324 input arguments list defines the ordering of the lines. 2325 * <p> 2326 * Note that the method returns {@code this} builder to allow for command 2327 * chaining. The command itself is returned by the {@link #build()} method. 2328 * See {@link Unix4jCommandBuilder class comments} for more information. 2329 * 2330 * @param files The files to be sorted or merged; relative paths are not resolved 2331 (use the string paths argument to enable relative path resolving 2332 based on the current working directory). 2333 * @return {@code this} builder to allow for method chaining; method 2334 * chaining is used here to create command chains; adding a command 2335 * to the chain usually means that the previous command <i>pipes</i> 2336 * its output to the next command (the pipe symbol in unix) 2337 */ 2338 @Override 2339 Unix4jCommandBuilder sort(java.io.File... files); 2340 /** 2341 * Sort the lines of all the specified inputs together and writes the 2342 result to the standard output. 2343<p> 2344 Comparisons are based on the entire line without line ending. The 2345 collating sequence of the current locale is used to perform the 2346 comparisons. 2347<p> 2348 The sort algorithm used is guaranteed to be stable: lines considered 2349 equal will not be reordered as a result of the sort. If two lines 2350 originate from different inputs, the index of the input in the 2351 arguments list defines the ordering of the lines. 2352 * <p> 2353 * Note that the method returns {@code this} builder to allow for command 2354 * chaining. The command itself is returned by the {@link #build()} method. 2355 * See {@link Unix4jCommandBuilder class comments} for more information. 2356 * 2357 * @param inputs The inputs to be sorted or merged. 2358 * @return {@code this} builder to allow for method chaining; method 2359 * chaining is used here to create command chains; adding a command 2360 * to the chain usually means that the previous command <i>pipes</i> 2361 * its output to the next command (the pipe symbol in unix) 2362 */ 2363 @Override 2364 Unix4jCommandBuilder sort(org.unix4j.io.Input... inputs); 2365 /** 2366 * Sort the lines read from the standard input and writes the result to 2367 the standard output. 2368 <p> 2369 Line comparisons are based on the specified {@code comparator}. 2370 <p> 2371 The sort algorithm used is guaranteed to be stable: lines considered 2372 equal will not be reordered as a result of the sort. 2373 * <p> 2374 * Note that the method returns {@code this} builder to allow for command 2375 * chaining. The command itself is returned by the {@link #build()} method. 2376 * See {@link Unix4jCommandBuilder class comments} for more information. 2377 * 2378 * @param comparator The comparator to use for the line comparisons. 2379 * @return {@code this} builder to allow for method chaining; method 2380 * chaining is used here to create command chains; adding a command 2381 * to the chain usually means that the previous command <i>pipes</i> 2382 * its output to the next command (the pipe symbol in unix) 2383 */ 2384 @Override 2385 Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator); 2386 /** 2387 * Sort the lines of all the specified files together and writes the 2388 result to the standard output. 2389 <p> 2390 Line comparisons are based on the specified {@code comparator}. 2391 <p> 2392 The sort algorithm used is guaranteed to be stable: lines considered 2393 equal will not be reordered as a result of the sort. If two lines 2394 originate from different input files, the index of the file in the 2395 input arguments list defines the ordering of the lines. 2396 * <p> 2397 * Note that the method returns {@code this} builder to allow for command 2398 * chaining. The command itself is returned by the {@link #build()} method. 2399 * See {@link Unix4jCommandBuilder class comments} for more information. 2400 * 2401 * @param comparator The comparator to use for the line comparisons. 2402 * @param files The files to be sorted or merged; relative paths are not resolved 2403 (use the string paths argument to enable relative path resolving 2404 based on the current working directory). 2405 * @return {@code this} builder to allow for method chaining; method 2406 * chaining is used here to create command chains; adding a command 2407 * to the chain usually means that the previous command <i>pipes</i> 2408 * its output to the next command (the pipe symbol in unix) 2409 */ 2410 @Override 2411 Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files); 2412 /** 2413 * Sort the lines of all the specified files together and writes the 2414 result to the standard output. 2415 <p> 2416 Line comparisons are based on the specified {@code comparator}. 2417 <p> 2418 The sort algorithm used is guaranteed to be stable: lines considered 2419 equal will not be reordered as a result of the sort. If two lines 2420 originate from different input files, the index of the file in the 2421 input arguments list defines the ordering of the lines. 2422 * <p> 2423 * Note that the method returns {@code this} builder to allow for command 2424 * chaining. The command itself is returned by the {@link #build()} method. 2425 * See {@link Unix4jCommandBuilder class comments} for more information. 2426 * 2427 * @param comparator The comparator to use for the line comparisons. 2428 * @param paths Path names of the files to be sorted, merged, or checked; wildcards * 2429 and ? are supported; relative paths are resolved on the 2430 basis of the current working directory. 2431 * @return {@code this} builder to allow for method chaining; method 2432 * chaining is used here to create command chains; adding a command 2433 * to the chain usually means that the previous command <i>pipes</i> 2434 * its output to the next command (the pipe symbol in unix) 2435 */ 2436 @Override 2437 Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths); 2438 /** 2439 * Sort the lines of all the specified inputs together and writes the 2440 result to the standard output. 2441<p> 2442 Line comparisons are based on the specified {@code comparator}. 2443<p> 2444 The sort algorithm used is guaranteed to be stable: lines considered 2445 equal will not be reordered as a result of the sort. If two lines 2446 originate from different inputs, the index of the input in the 2447 arguments list defines the ordering of the lines. 2448 * <p> 2449 * Note that the method returns {@code this} builder to allow for command 2450 * chaining. The command itself is returned by the {@link #build()} method. 2451 * See {@link Unix4jCommandBuilder class comments} for more information. 2452 * 2453 * @param comparator The comparator to use for the line comparisons. 2454 * @param inputs The inputs to be sorted or merged. 2455 * @return {@code this} builder to allow for method chaining; method 2456 * chaining is used here to create command chains; adding a command 2457 * to the chain usually means that the previous command <i>pipes</i> 2458 * its output to the next command (the pipe symbol in unix) 2459 */ 2460 @Override 2461 Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, org.unix4j.io.Input... inputs); 2462 /** 2463 * Sorts, merges, or sequence checks the lines read from the standard 2464 input and writes the result to the standard output. 2465 <p> 2466 Comparisons are based on the entire line without line ending. The 2467 collating sequence of the current locale is used to perform the 2468 comparisons. 2469 <p> 2470 The sort algorithm used is guaranteed to be stable: lines considered 2471 equal will not be reordered as a result of the sort. 2472 * <p> 2473 * Note that the method returns {@code this} builder to allow for command 2474 * chaining. The command itself is returned by the {@link #build()} method. 2475 * See {@link Unix4jCommandBuilder class comments} for more information. 2476 * 2477 * @param options The options for the sort command. 2478 * @return {@code this} builder to allow for method chaining; method 2479 * chaining is used here to create command chains; adding a command 2480 * to the chain usually means that the previous command <i>pipes</i> 2481 * its output to the next command (the pipe symbol in unix) 2482 */ 2483 @Override 2484 Unix4jCommandBuilder sort(SortOptions options); 2485 /** 2486 * Sorts, merges, or sequence checks the lines the lines of all the 2487 specified files together and writes the result to the standard 2488 output. 2489 <p> 2490 Comparisons are based on the entire line without line ending. The 2491 collating sequence of the current locale is used to perform the 2492 comparisons. 2493 <p> 2494 The sort algorithm used is guaranteed to be stable: lines considered 2495 equal will not be reordered as a result of the sort. If two lines 2496 originate from different input files, the index of the file in the 2497 input arguments list defines the ordering of the lines. 2498 * <p> 2499 * Note that the method returns {@code this} builder to allow for command 2500 * chaining. The command itself is returned by the {@link #build()} method. 2501 * See {@link Unix4jCommandBuilder class comments} for more information. 2502 * 2503 * @param options The options for the sort command. 2504 * @param files The files to be sorted or merged; relative paths are not resolved 2505 (use the string paths argument to enable relative path resolving 2506 based on the current working directory). 2507 * @return {@code this} builder to allow for method chaining; method 2508 * chaining is used here to create command chains; adding a command 2509 * to the chain usually means that the previous command <i>pipes</i> 2510 * its output to the next command (the pipe symbol in unix) 2511 */ 2512 @Override 2513 Unix4jCommandBuilder sort(SortOptions options, java.io.File... files); 2514 /** 2515 * Sorts, merges, or sequence checks the lines the lines of all the 2516 specified files together and writes the result to the standard 2517 output. 2518 <p> 2519 Comparisons are based on the entire line without line ending. The 2520 collating sequence of the current locale is used to perform the 2521 comparisons. 2522 <p> 2523 The sort algorithm used is guaranteed to be stable: lines considered 2524 equal will not be reordered as a result of the sort. If two lines 2525 originate from different input files, the index of the file in the 2526 input arguments list defines the ordering of the lines. 2527 * <p> 2528 * Note that the method returns {@code this} builder to allow for command 2529 * chaining. The command itself is returned by the {@link #build()} method. 2530 * See {@link Unix4jCommandBuilder class comments} for more information. 2531 * 2532 * @param options The options for the sort command. 2533 * @param paths Path names of the files to be sorted, merged, or checked; wildcards * 2534 and ? are supported; relative paths are resolved on the 2535 basis of the current working directory. 2536 * @return {@code this} builder to allow for method chaining; method 2537 * chaining is used here to create command chains; adding a command 2538 * to the chain usually means that the previous command <i>pipes</i> 2539 * its output to the next command (the pipe symbol in unix) 2540 */ 2541 @Override 2542 Unix4jCommandBuilder sort(SortOptions options, String... paths); 2543 /** 2544 * Sorts, merges, or sequence checks the lines the lines of all the 2545 specified inputs together and writes the result to the standard 2546 output. 2547<p> 2548 Comparisons are based on the entire line without line ending. The 2549 collating sequence of the current locale is used to perform the 2550 comparisons. 2551<p> 2552 The sort algorithm used is guaranteed to be stable: lines considered 2553 equal will not be reordered as a result of the sort. If two lines 2554 originate from different inputs, the index of the input in the 2555 arguments list defines the ordering of the lines. 2556 * <p> 2557 * Note that the method returns {@code this} builder to allow for command 2558 * chaining. The command itself is returned by the {@link #build()} method. 2559 * See {@link Unix4jCommandBuilder class comments} for more information. 2560 * 2561 * @param options The options for the sort command. 2562 * @param inputs The inputs to be sorted or merged. 2563 * @return {@code this} builder to allow for method chaining; method 2564 * chaining is used here to create command chains; adding a command 2565 * to the chain usually means that the previous command <i>pipes</i> 2566 * its output to the next command (the pipe symbol in unix) 2567 */ 2568 @Override 2569 Unix4jCommandBuilder sort(SortOptions options, org.unix4j.io.Input... inputs); 2570 /** 2571 * Sorts, merges, or sequence checks the lines read from the standard 2572 input and writes the result to the standard output. 2573 <p> 2574 Line comparisons are based on the specified {@code comparator}. 2575 All comparison related options are ignored except for 2576 {@code --reverse}. 2577 <p> 2578 The sort algorithm used is guaranteed to be stable: lines considered 2579 equal will not be reordered as a result of the sort. 2580 * <p> 2581 * Note that the method returns {@code this} builder to allow for command 2582 * chaining. The command itself is returned by the {@link #build()} method. 2583 * See {@link Unix4jCommandBuilder class comments} for more information. 2584 * 2585 * @param options The options for the sort command. 2586 * @param comparator The comparator to use for the line comparisons. 2587 * @return {@code this} builder to allow for method chaining; method 2588 * chaining is used here to create command chains; adding a command 2589 * to the chain usually means that the previous command <i>pipes</i> 2590 * its output to the next command (the pipe symbol in unix) 2591 */ 2592 @Override 2593 Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator); 2594 /** 2595 * Sorts, merges, or sequence checks the lines the lines of all the 2596 specified files together and writes the result to the standard 2597 output. 2598 <p> 2599 Line comparisons are based on the specified {@code comparator}. 2600 All comparison related options except for {@code --reverse} are 2601 ignored. 2602 <p> 2603 The sort algorithm used is guaranteed to be stable: lines considered 2604 equal will not be reordered as a result of the sort. If two lines 2605 originate from different input files, the index of the file in the 2606 input arguments list defines the ordering of the lines. 2607 * <p> 2608 * Note that the method returns {@code this} builder to allow for command 2609 * chaining. The command itself is returned by the {@link #build()} method. 2610 * See {@link Unix4jCommandBuilder class comments} for more information. 2611 * 2612 * @param options The options for the sort command. 2613 * @param comparator The comparator to use for the line comparisons. 2614 * @param files The files to be sorted or merged; relative paths are not resolved 2615 (use the string paths argument to enable relative path resolving 2616 based on the current working directory). 2617 * @return {@code this} builder to allow for method chaining; method 2618 * chaining is used here to create command chains; adding a command 2619 * to the chain usually means that the previous command <i>pipes</i> 2620 * its output to the next command (the pipe symbol in unix) 2621 */ 2622 @Override 2623 Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files); 2624 /** 2625 * Sorts, merges, or sequence checks the lines the lines of all the 2626 specified files together and writes the result to the standard 2627 output. 2628 <p> 2629 Line comparisons are based on the specified {@code comparator}. 2630 All comparison related options except for {@code --reverse} are 2631 ignored. 2632 <p> 2633 The sort algorithm used is guaranteed to be stable: lines considered 2634 equal will not be reordered as a result of the sort. If two lines 2635 originate from different input files, the index of the file in the 2636 input arguments list defines the ordering of the lines. 2637 * <p> 2638 * Note that the method returns {@code this} builder to allow for command 2639 * chaining. The command itself is returned by the {@link #build()} method. 2640 * See {@link Unix4jCommandBuilder class comments} for more information. 2641 * 2642 * @param options The options for the sort command. 2643 * @param comparator The comparator to use for the line comparisons. 2644 * @param paths Path names of the files to be sorted, merged, or checked; wildcards * 2645 and ? are supported; relative paths are resolved on the 2646 basis of the current working directory. 2647 * @return {@code this} builder to allow for method chaining; method 2648 * chaining is used here to create command chains; adding a command 2649 * to the chain usually means that the previous command <i>pipes</i> 2650 * its output to the next command (the pipe symbol in unix) 2651 */ 2652 @Override 2653 Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths); 2654 /** 2655 * Sorts, merges, or sequence checks the lines the lines of all the 2656 specified inputs together and writes the result to the standard 2657 output. 2658<p> 2659 Line comparisons are based on the specified {@code comparator}. 2660 All comparison related options except for {@code --reverse} are 2661 ignored. 2662<p> 2663 The sort algorithm used is guaranteed to be stable: lines considered 2664 equal will not be reordered as a result of the sort. If two lines 2665 originate from different inputs, the index of the input in the 2666 arguments list defines the ordering of the lines. 2667 * <p> 2668 * Note that the method returns {@code this} builder to allow for command 2669 * chaining. The command itself is returned by the {@link #build()} method. 2670 * See {@link Unix4jCommandBuilder class comments} for more information. 2671 * 2672 * @param options The options for the sort command. 2673 * @param comparator The comparator to use for the line comparisons. 2674 * @param inputs The inputs to be sorted or merged. 2675 * @return {@code this} builder to allow for method chaining; method 2676 * chaining is used here to create command chains; adding a command 2677 * to the chain usually means that the previous command <i>pipes</i> 2678 * its output to the next command (the pipe symbol in unix) 2679 */ 2680 @Override 2681 Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, org.unix4j.io.Input... inputs); 2682 2683 /* ------------------ tail ------------------ */ 2684 /** 2685 * Reads the last 10 lines from the standard input and writes them to 2686 the standard output. 2687 * <p> 2688 * Note that the method returns {@code this} builder to allow for command 2689 * chaining. The command itself is returned by the {@link #build()} method. 2690 * See {@link Unix4jCommandBuilder class comments} for more information. 2691 * 2692 * @return {@code this} builder to allow for method chaining; method 2693 * chaining is used here to create command chains; adding a command 2694 * to the chain usually means that the previous command <i>pipes</i> 2695 * its output to the next command (the pipe symbol in unix) 2696 */ 2697 @Override 2698 Unix4jCommandBuilder tail(); 2699 /** 2700 * Reads the last n lines from each of the files specified and writes 2701 them to the standard output. If more than a single file is 2702 specified, each file is preceded by a header consisting of the 2703 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2704 of the file. 2705<p> 2706 Options can be specified by acronym (with a leading dash "-") or by 2707 long name (with two leading dashes "--"). Operands other than the 2708 default "--paths" operand have to be prefixed with the operand 2709 name. 2710 * <p> 2711 * Note that the method returns {@code this} builder to allow for command 2712 * chaining. The command itself is returned by the {@link #build()} method. 2713 * See {@link Unix4jCommandBuilder class comments} for more information. 2714 * 2715 * @param args String arguments defining the options and operands for the command. 2716 Options can be specified by acronym (with a leading dash "-") or by 2717 long name (with two leading dashes "--"). Operands other than the 2718 default "--paths" operand have to be prefixed with the operand 2719 name (e.g. "--count" for a subsequent count operand value). 2720 * @return {@code this} builder to allow for method chaining; method 2721 * chaining is used here to create command chains; adding a command 2722 * to the chain usually means that the previous command <i>pipes</i> 2723 * its output to the next command (the pipe symbol in unix) 2724 */ 2725 @Override 2726 Unix4jCommandBuilder tail(String... args); 2727 /** 2728 * Reads the last {@code count} lines from the standard input and 2729 writes them to the standard output. 2730 * <p> 2731 * Note that the method returns {@code this} builder to allow for command 2732 * chaining. The command itself is returned by the {@link #build()} method. 2733 * See {@link Unix4jCommandBuilder class comments} for more information. 2734 * 2735 * @param count The last {@code count} lines of each input file are 2736 copied to standard output, starting from 1 (characters instead of 2737 lines if the {@code -c} option is specified, and offset from start 2738 instead of end with {@code -s} option). Must be a non-negative 2739 integer or an exception is thrown. If {@code count} is greater than 2740 the number number of lines (characters) in the input, the 2741 application will not error and send the whole file to the output. 2742 * @return {@code this} builder to allow for method chaining; method 2743 * chaining is used here to create command chains; adding a command 2744 * to the chain usually means that the previous command <i>pipes</i> 2745 * its output to the next command (the pipe symbol in unix) 2746 */ 2747 @Override 2748 Unix4jCommandBuilder tail(long count); 2749 /** 2750 * Reads the last {@code count} lines or characters from the standard 2751 input and writes them to the standard output. 2752 * <p> 2753 * Note that the method returns {@code this} builder to allow for command 2754 * chaining. The command itself is returned by the {@link #build()} method. 2755 * See {@link Unix4jCommandBuilder class comments} for more information. 2756 * 2757 * @param options Options for the tail command. 2758 * @param count The last {@code count} lines of each input file are 2759 copied to standard output, starting from 1 (characters instead of 2760 lines if the {@code -c} option is specified, and offset from start 2761 instead of end with {@code -s} option). Must be a non-negative 2762 integer or an exception is thrown. If {@code count} is greater than 2763 the number number of lines (characters) in the input, the 2764 application will not error and send the whole file to the output. 2765 * @return {@code this} builder to allow for method chaining; method 2766 * chaining is used here to create command chains; adding a command 2767 * to the chain usually means that the previous command <i>pipes</i> 2768 * its output to the next command (the pipe symbol in unix) 2769 */ 2770 @Override 2771 Unix4jCommandBuilder tail(TailOptions options, long count); 2772 /** 2773 * Reads the last 10 lines from each of the specified files and writes 2774 them to the standard output. If more than a single file is 2775 specified, each file is preceded by a header consisting of the 2776 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2777 of the file. 2778 * <p> 2779 * Note that the method returns {@code this} builder to allow for command 2780 * chaining. The command itself is returned by the {@link #build()} method. 2781 * See {@link Unix4jCommandBuilder class comments} for more information. 2782 * 2783 * @param files The input files to be filtered; relative paths are not resolved (use 2784 the string paths argument to enable relative path resolving based on 2785 the current working directory). 2786 * @return {@code this} builder to allow for method chaining; method 2787 * chaining is used here to create command chains; adding a command 2788 * to the chain usually means that the previous command <i>pipes</i> 2789 * its output to the next command (the pipe symbol in unix) 2790 */ 2791 @Override 2792 Unix4jCommandBuilder tail(java.io.File... files); 2793 /** 2794 * Reads the last 10 lines from each of the specified inputs and writes 2795 them to the standard output. If more than a single input is 2796 specified, each one is preceded by a header consisting of the 2797 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 2798 string representation. 2799 * <p> 2800 * Note that the method returns {@code this} builder to allow for command 2801 * chaining. The command itself is returned by the {@link #build()} method. 2802 * See {@link Unix4jCommandBuilder class comments} for more information. 2803 * 2804 * @param inputs The inputs to be filtered. 2805 * @return {@code this} builder to allow for method chaining; method 2806 * chaining is used here to create command chains; adding a command 2807 * to the chain usually means that the previous command <i>pipes</i> 2808 * its output to the next command (the pipe symbol in unix) 2809 */ 2810 @Override 2811 Unix4jCommandBuilder tail(org.unix4j.io.Input... inputs); 2812 /** 2813 * Reads the last {@code count} lines from each of the specified files 2814 and writes them to the standard output. If more than a single file 2815 is specified, each file is preceded by a header consisting of the 2816 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2817 of the file. 2818 * <p> 2819 * Note that the method returns {@code this} builder to allow for command 2820 * chaining. The command itself is returned by the {@link #build()} method. 2821 * See {@link Unix4jCommandBuilder class comments} for more information. 2822 * 2823 * @param count The last {@code count} lines of each input file are 2824 copied to standard output, starting from 1 (characters instead of 2825 lines if the {@code -c} option is specified, and offset from start 2826 instead of end with {@code -s} option). Must be a non-negative 2827 integer or an exception is thrown. If {@code count} is greater than 2828 the number number of lines (characters) in the input, the 2829 application will not error and send the whole file to the output. 2830 * @param files The input files to be filtered; relative paths are not resolved (use 2831 the string paths argument to enable relative path resolving based on 2832 the current working directory). 2833 * @return {@code this} builder to allow for method chaining; method 2834 * chaining is used here to create command chains; adding a command 2835 * to the chain usually means that the previous command <i>pipes</i> 2836 * its output to the next command (the pipe symbol in unix) 2837 */ 2838 @Override 2839 Unix4jCommandBuilder tail(long count, java.io.File... files); 2840 /** 2841 * Reads the last {@code count} lines from each of the specified files 2842 and writes them to the standard output. If more than a single file 2843 is specified, each file is preceded by a header consisting of the 2844 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2845 of the file. 2846 * <p> 2847 * Note that the method returns {@code this} builder to allow for command 2848 * chaining. The command itself is returned by the {@link #build()} method. 2849 * See {@link Unix4jCommandBuilder class comments} for more information. 2850 * 2851 * @param count The last {@code count} lines of each input file are 2852 copied to standard output, starting from 1 (characters instead of 2853 lines if the {@code -c} option is specified, and offset from start 2854 instead of end with {@code -s} option). Must be a non-negative 2855 integer or an exception is thrown. If {@code count} is greater than 2856 the number number of lines (characters) in the input, the 2857 application will not error and send the whole file to the output. 2858 * @param paths Path names of the input files to be filtered; wildcards * and ? are 2859 supported; relative paths are resolved on the basis of the current 2860 working directory. 2861 * @return {@code this} builder to allow for method chaining; method 2862 * chaining is used here to create command chains; adding a command 2863 * to the chain usually means that the previous command <i>pipes</i> 2864 * its output to the next command (the pipe symbol in unix) 2865 */ 2866 @Override 2867 Unix4jCommandBuilder tail(long count, String... paths); 2868 /** 2869 * Reads the last {@code count} lines from each of the specified inputs 2870 and writes them to the standard output. If more than a single input 2871 is specified, each file is preceded by a header consisting of the 2872 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 2873 string representation. 2874 * <p> 2875 * Note that the method returns {@code this} builder to allow for command 2876 * chaining. The command itself is returned by the {@link #build()} method. 2877 * See {@link Unix4jCommandBuilder class comments} for more information. 2878 * 2879 * @param count The last {@code count} lines of each input file are 2880 copied to standard output, starting from 1 (characters instead of 2881 lines if the {@code -c} option is specified, and offset from start 2882 instead of end with {@code -s} option). Must be a non-negative 2883 integer or an exception is thrown. If {@code count} is greater than 2884 the number number of lines (characters) in the input, the 2885 application will not error and send the whole file to the output. 2886 * @param inputs The inputs to be filtered. 2887 * @return {@code this} builder to allow for method chaining; method 2888 * chaining is used here to create command chains; adding a command 2889 * to the chain usually means that the previous command <i>pipes</i> 2890 * its output to the next command (the pipe symbol in unix) 2891 */ 2892 @Override 2893 Unix4jCommandBuilder tail(long count, org.unix4j.io.Input... inputs); 2894 /** 2895 * Reads the last {@code count} lines or characters from each of the 2896 specified files and writes them to the standard output. If more than 2897 a single file is specified and the {@code -q} option is not 2898 specified, each file is preceded by a header consisting of the 2899 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2900 of the file. 2901 * <p> 2902 * Note that the method returns {@code this} builder to allow for command 2903 * chaining. The command itself is returned by the {@link #build()} method. 2904 * See {@link Unix4jCommandBuilder class comments} for more information. 2905 * 2906 * @param options Options for the tail command. 2907 * @param count The last {@code count} lines of each input file are 2908 copied to standard output, starting from 1 (characters instead of 2909 lines if the {@code -c} option is specified, and offset from start 2910 instead of end with {@code -s} option). Must be a non-negative 2911 integer or an exception is thrown. If {@code count} is greater than 2912 the number number of lines (characters) in the input, the 2913 application will not error and send the whole file to the output. 2914 * @param files The input files to be filtered; relative paths are not resolved (use 2915 the string paths argument to enable relative path resolving based on 2916 the current working directory). 2917 * @return {@code this} builder to allow for method chaining; method 2918 * chaining is used here to create command chains; adding a command 2919 * to the chain usually means that the previous command <i>pipes</i> 2920 * its output to the next command (the pipe symbol in unix) 2921 */ 2922 @Override 2923 Unix4jCommandBuilder tail(TailOptions options, long count, java.io.File... files); 2924 /** 2925 * Reads the last {@code count} lines or characters from each of the 2926 specified files and writes them to the standard output. If more than 2927 a single file is specified and the {@code -q} option is not 2928 specified, each file is preceded by a header consisting of the 2929 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2930 of the file. 2931 * <p> 2932 * Note that the method returns {@code this} builder to allow for command 2933 * chaining. The command itself is returned by the {@link #build()} method. 2934 * See {@link Unix4jCommandBuilder class comments} for more information. 2935 * 2936 * @param options Options for the tail command. 2937 * @param count The last {@code count} lines of each input file are 2938 copied to standard output, starting from 1 (characters instead of 2939 lines if the {@code -c} option is specified, and offset from start 2940 instead of end with {@code -s} option). Must be a non-negative 2941 integer or an exception is thrown. If {@code count} is greater than 2942 the number number of lines (characters) in the input, the 2943 application will not error and send the whole file to the output. 2944 * @param paths Path names of the input files to be filtered; wildcards * and ? are 2945 supported; relative paths are resolved on the basis of the current 2946 working directory. 2947 * @return {@code this} builder to allow for method chaining; method 2948 * chaining is used here to create command chains; adding a command 2949 * to the chain usually means that the previous command <i>pipes</i> 2950 * its output to the next command (the pipe symbol in unix) 2951 */ 2952 @Override 2953 Unix4jCommandBuilder tail(TailOptions options, long count, String... paths); 2954 /** 2955 * Reads the last {@code count} lines or characters from each of the 2956 specified inputs and writes them to the standard output. If more than 2957 a single input is specified and the {@code -q} option is not 2958 specified, each file is preceded by a header consisting of the 2959 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 2960 string representation. 2961 * <p> 2962 * Note that the method returns {@code this} builder to allow for command 2963 * chaining. The command itself is returned by the {@link #build()} method. 2964 * See {@link Unix4jCommandBuilder class comments} for more information. 2965 * 2966 * @param options Options for the tail command. 2967 * @param count The last {@code count} lines of each input file are 2968 copied to standard output, starting from 1 (characters instead of 2969 lines if the {@code -c} option is specified, and offset from start 2970 instead of end with {@code -s} option). Must be a non-negative 2971 integer or an exception is thrown. If {@code count} is greater than 2972 the number number of lines (characters) in the input, the 2973 application will not error and send the whole file to the output. 2974 * @param inputs The inputs to be filtered. 2975 * @return {@code this} builder to allow for method chaining; method 2976 * chaining is used here to create command chains; adding a command 2977 * to the chain usually means that the previous command <i>pipes</i> 2978 * its output to the next command (the pipe symbol in unix) 2979 */ 2980 @Override 2981 Unix4jCommandBuilder tail(TailOptions options, long count, org.unix4j.io.Input... inputs); 2982 2983 /* ------------------ uniq ------------------ */ 2984 /** 2985 * Reads from the standard input and compares adjacent lines, writing 2986 one copy of each input line to the standard output. The second and 2987 succeeding copies of repeated adjacent input lines are not written 2988 to the output. 2989 <p> 2990 Note that repeated lines in the input are not detected if they are 2991 not adjacent (see --global or -g option); sorted input lines always 2992 result in unique output lines. 2993 * <p> 2994 * Note that the method returns {@code this} builder to allow for command 2995 * chaining. The command itself is returned by the {@link #build()} method. 2996 * See {@link Unix4jCommandBuilder class comments} for more information. 2997 * 2998 * @return {@code this} builder to allow for method chaining; method 2999 * chaining is used here to create command chains; adding a command 3000 * to the chain usually means that the previous command <i>pipes</i> 3001 * its output to the next command (the pipe symbol in unix) 3002 */ 3003 @Override 3004 Unix4jCommandBuilder uniq(); 3005 /** 3006 * Reads the file specified by the {@code "--path"} operand (the 3007 default operand) and writes only unique lines to the standard 3008 output. The second and succeeding copies of repeated input lines are 3009 not written to the output. 3010 <p> 3011 Options can be specified by acronym (with a leading dash "-") or by 3012 long name (with two leading dashes "--"). Operands other than the 3013 default "--path" operand have to be prefixed with the operand name. 3014<p> 3015 Note that repeated lines in the input are not detected if they are 3016 not adjacent unless the --global is specified (sorted input lines 3017 always result in unique output lines). 3018 * <p> 3019 * Note that the method returns {@code this} builder to allow for command 3020 * chaining. The command itself is returned by the {@link #build()} method. 3021 * See {@link Unix4jCommandBuilder class comments} for more information. 3022 * 3023 * @param args String arguments defining the options and operands for the command. 3024 Options can be specified by acronym (with a leading dash "-") or by 3025 long name (with two leading dashes "--"). Operands other than the 3026 default "--path" operand have to be prefixed with the operand 3027 name. 3028 * @return {@code this} builder to allow for method chaining; method 3029 * chaining is used here to create command chains; adding a command 3030 * to the chain usually means that the previous command <i>pipes</i> 3031 * its output to the next command (the pipe symbol in unix) 3032 */ 3033 @Override 3034 Unix4jCommandBuilder uniq(String... args); 3035 /** 3036 * Reads from the specified input {@code file} and compares adjacent 3037 lines, writing one copy of each input line to the standard output. 3038 The second and succeeding copies of repeated adjacent input lines 3039 are not written to the output. 3040 <p> 3041 Note that repeated lines in the input are not detected if they are 3042 not adjacent (see --global or -g option); sorted input lines always 3043 result in unique output lines. 3044 * <p> 3045 * Note that the method returns {@code this} builder to allow for command 3046 * chaining. The command itself is returned by the {@link #build()} method. 3047 * See {@link Unix4jCommandBuilder class comments} for more information. 3048 * 3049 * @param file The files or directories used as starting point for the listing; 3050 relative paths are not resolved (use the string path argument to 3051 enable relative path resolving based on the current working 3052 directory). 3053 * @return {@code this} builder to allow for method chaining; method 3054 * chaining is used here to create command chains; adding a command 3055 * to the chain usually means that the previous command <i>pipes</i> 3056 * its output to the next command (the pipe symbol in unix) 3057 */ 3058 @Override 3059 Unix4jCommandBuilder uniq(java.io.File file); 3060 /** 3061 * Reads the file specified by its {@code path} and compares adjacent 3062 lines, writing one copy of each input line to the standard output. 3063 The second and succeeding copies of repeated adjacent input lines 3064 are not written to the output. 3065 <p> 3066 Note that repeated lines in the input are not detected if they are 3067 not adjacent (see --global or -g option); sorted input lines always 3068 result in unique output lines. 3069 * <p> 3070 * Note that the method returns {@code this} builder to allow for command 3071 * chaining. The command itself is returned by the {@link #build()} method. 3072 * See {@link Unix4jCommandBuilder class comments} for more information. 3073 * 3074 * @param path The files or directories used as starting point for the listing; 3075 wildcards * and ? are supported; relative paths are resolved on the 3076 basis of the current working directory. 3077 * @return {@code this} builder to allow for method chaining; method 3078 * chaining is used here to create command chains; adding a command 3079 * to the chain usually means that the previous command <i>pipes</i> 3080 * its output to the next command (the pipe symbol in unix) 3081 */ 3082 @Override 3083 Unix4jCommandBuilder uniq(String path); 3084 /** 3085 * Reads from the standard input and compares adjacent lines, writing 3086 one copy of each input line to the standard output. The second and 3087 succeeding copies of repeated adjacent input lines are not written 3088 to the output. 3089 <p> 3090 Note that repeated non-adjacent lines in the input are only detected 3091 with the --global or -g option. In other words, unique output lines 3092 are guaranteed only if either (a) the --global or -g option is 3093 specified, or (b) the input lines are sorted. 3094 * <p> 3095 * Note that the method returns {@code this} builder to allow for command 3096 * chaining. The command itself is returned by the {@link #build()} method. 3097 * See {@link Unix4jCommandBuilder class comments} for more information. 3098 * 3099 * @param options The options defining the uniqueness details for the output lines. 3100 * @return {@code this} builder to allow for method chaining; method 3101 * chaining is used here to create command chains; adding a command 3102 * to the chain usually means that the previous command <i>pipes</i> 3103 * its output to the next command (the pipe symbol in unix) 3104 */ 3105 @Override 3106 Unix4jCommandBuilder uniq(UniqOptions options); 3107 /** 3108 * Reads from the specified input {@code file} and compares adjacent 3109 lines, writing one copy of each input line to the standard output. 3110 The second and succeeding copies of repeated adjacent input lines 3111 are not written to the output. 3112 <p> 3113 Note that repeated non-adjacent lines in the input are only detected 3114 with the --global or -g option. In other words, unique output lines 3115 are guaranteed only if either (a) the --global or -g option is 3116 specified, or (b) the input lines are sorted. 3117 * <p> 3118 * Note that the method returns {@code this} builder to allow for command 3119 * chaining. The command itself is returned by the {@link #build()} method. 3120 * See {@link Unix4jCommandBuilder class comments} for more information. 3121 * 3122 * @param options The options defining the uniqueness details for the output lines. 3123 * @param file The files or directories used as starting point for the listing; 3124 relative paths are not resolved (use the string path argument to 3125 enable relative path resolving based on the current working 3126 directory). 3127 * @return {@code this} builder to allow for method chaining; method 3128 * chaining is used here to create command chains; adding a command 3129 * to the chain usually means that the previous command <i>pipes</i> 3130 * its output to the next command (the pipe symbol in unix) 3131 */ 3132 @Override 3133 Unix4jCommandBuilder uniq(UniqOptions options, java.io.File file); 3134 /** 3135 * Reads the file specified by its {@code path} and compares adjacent 3136 lines, writing one copy of each input line to the standard output. 3137 The second and succeeding copies of repeated adjacent input lines 3138 are not written to the output. 3139 <p> 3140 Note that repeated non-adjacent lines in the input are only detected 3141 with the --global or -g option. In other words, unique output lines 3142 are guaranteed only if either (a) the --global or -g option is 3143 specified, or (b) the input lines are sorted. 3144 * <p> 3145 * Note that the method returns {@code this} builder to allow for command 3146 * chaining. The command itself is returned by the {@link #build()} method. 3147 * See {@link Unix4jCommandBuilder class comments} for more information. 3148 * 3149 * @param options The options defining the uniqueness details for the output lines. 3150 * @param path The files or directories used as starting point for the listing; 3151 wildcards * and ? are supported; relative paths are resolved on the 3152 basis of the current working directory. 3153 * @return {@code this} builder to allow for method chaining; method 3154 * chaining is used here to create command chains; adding a command 3155 * to the chain usually means that the previous command <i>pipes</i> 3156 * its output to the next command (the pipe symbol in unix) 3157 */ 3158 @Override 3159 Unix4jCommandBuilder uniq(UniqOptions options, String path); 3160 3161 /* ------------------ wc ------------------ */ 3162 /** 3163 * Executes a count of lines, words and chars contained in the standard 3164 input and writes them to the standard output. 3165 * <p> 3166 * Note that the method returns {@code this} builder to allow for command 3167 * chaining. The command itself is returned by the {@link #build()} method. 3168 * See {@link Unix4jCommandBuilder class comments} for more information. 3169 * 3170 * @return {@code this} builder to allow for method chaining; method 3171 * chaining is used here to create command chains; adding a command 3172 * to the chain usually means that the previous command <i>pipes</i> 3173 * its output to the next command (the pipe symbol in unix) 3174 */ 3175 @Override 3176 Unix4jCommandBuilder wc(); 3177 /** 3178 * One or several counts are executed and written to the standard 3179 output. Counts include lines, words and chars (depending on the 3180 provided options) and cumulative counts for all the files are 3181 displayed on a separate line after the output for the last file if 3182 more than one input file is specified. 3183<p> 3184 Options can be specified by acronym (with a leading dash "-") or by 3185 long name (with two leading dashes "--"). Operands other than the 3186 default "--paths" operand have to be prefixed with the operand 3187 name. 3188 * <p> 3189 * Note that the method returns {@code this} builder to allow for command 3190 * chaining. The command itself is returned by the {@link #build()} method. 3191 * See {@link Unix4jCommandBuilder class comments} for more information. 3192 * 3193 * @param args String arguments defining the options and operands for the command. 3194 Options can be specified by acronym (with a leading dash "-") or by 3195 long name (with two leading dashes "--"). Operands other than the 3196 default "--paths" operand have to be prefixed with the operand 3197 name. 3198 * @return {@code this} builder to allow for method chaining; method 3199 * chaining is used here to create command chains; adding a command 3200 * to the chain usually means that the previous command <i>pipes</i> 3201 * its output to the next command (the pipe symbol in unix) 3202 */ 3203 @Override 3204 Unix4jCommandBuilder wc(String... args); 3205 /** 3206 * Executes a count of lines, words and chars contained in each input 3207 file and writes them to the standard output. If more than one input 3208 file is specified, a line of cumulative counts for all the files is 3209 displayed on a separate line after the output for the last file. 3210 * <p> 3211 * Note that the method returns {@code this} builder to allow for command 3212 * chaining. The command itself is returned by the {@link #build()} method. 3213 * See {@link Unix4jCommandBuilder class comments} for more information. 3214 * 3215 * @param files The input files; relative paths are not resolved (use the string 3216 paths argument to enable relative path resolving based on the 3217 current working directory). 3218 * @return {@code this} builder to allow for method chaining; method 3219 * chaining is used here to create command chains; adding a command 3220 * to the chain usually means that the previous command <i>pipes</i> 3221 * its output to the next command (the pipe symbol in unix) 3222 */ 3223 @Override 3224 Unix4jCommandBuilder wc(java.io.File... files); 3225 /** 3226 * Executes a count of lines, words and chars contained in each input 3227 and writes them to the standard output. If more than one input 3228 is specified, a line of cumulative counts for all the inputs is 3229 displayed on a separate line after the output for the last input. 3230 * <p> 3231 * Note that the method returns {@code this} builder to allow for command 3232 * chaining. The command itself is returned by the {@link #build()} method. 3233 * See {@link Unix4jCommandBuilder class comments} for more information. 3234 * 3235 * @param inputs The inputs. 3236 * @return {@code this} builder to allow for method chaining; method 3237 * chaining is used here to create command chains; adding a command 3238 * to the chain usually means that the previous command <i>pipes</i> 3239 * its output to the next command (the pipe symbol in unix) 3240 */ 3241 @Override 3242 Unix4jCommandBuilder wc(org.unix4j.io.Input... inputs); 3243 /** 3244 * Executes a one or more counts, depending on the given options, in 3245 the standard input and writes them to the standard output. 3246 * <p> 3247 * Note that the method returns {@code this} builder to allow for command 3248 * chaining. The command itself is returned by the {@link #build()} method. 3249 * See {@link Unix4jCommandBuilder class comments} for more information. 3250 * 3251 * @param options The options defining command behavior. 3252 * @return {@code this} builder to allow for method chaining; method 3253 * chaining is used here to create command chains; adding a command 3254 * to the chain usually means that the previous command <i>pipes</i> 3255 * its output to the next command (the pipe symbol in unix) 3256 */ 3257 @Override 3258 Unix4jCommandBuilder wc(WcOptions options); 3259 /** 3260 * Executes a one or more counts, depending on the given options, in 3261 each of the given input files and writes them to the standard 3262 output. If more than one input file is specified, a line of 3263 cumulative counts for all the files is displayed on a separate line 3264 after the output for the last file. 3265 * <p> 3266 * Note that the method returns {@code this} builder to allow for command 3267 * chaining. The command itself is returned by the {@link #build()} method. 3268 * See {@link Unix4jCommandBuilder class comments} for more information. 3269 * 3270 * @param options The options defining command behavior. 3271 * @param files The input files; relative paths are not resolved (use the string 3272 paths argument to enable relative path resolving based on the 3273 current working directory). 3274 * @return {@code this} builder to allow for method chaining; method 3275 * chaining is used here to create command chains; adding a command 3276 * to the chain usually means that the previous command <i>pipes</i> 3277 * its output to the next command (the pipe symbol in unix) 3278 */ 3279 @Override 3280 Unix4jCommandBuilder wc(WcOptions options, java.io.File... files); 3281 /** 3282 * Executes a one or more counts, depending on the given options, in 3283 each of the given input files and writes them to the standard 3284 output. If more than one input file is specified, a line of 3285 cumulative counts for all the files is displayed on a separate line 3286 after the output for the last file. 3287 * <p> 3288 * Note that the method returns {@code this} builder to allow for command 3289 * chaining. The command itself is returned by the {@link #build()} method. 3290 * See {@link Unix4jCommandBuilder class comments} for more information. 3291 * 3292 * @param options The options defining command behavior. 3293 * @param paths Path names of the input files; wildcards * and ? are supported; 3294 relative paths are resolved on the basis of the current working 3295 directory. 3296 * @return {@code this} builder to allow for method chaining; method 3297 * chaining is used here to create command chains; adding a command 3298 * to the chain usually means that the previous command <i>pipes</i> 3299 * its output to the next command (the pipe symbol in unix) 3300 */ 3301 @Override 3302 Unix4jCommandBuilder wc(WcOptions options, String[] paths); 3303 /** 3304 * Executes a one or more counts, depending on the given options, in 3305 each of the given inputs and writes them to the standard 3306 output. If more than one inputs is specified, a line of 3307 cumulative counts for all the inputs is displayed on a separate line 3308 after the output for the last input. 3309 * <p> 3310 * Note that the method returns {@code this} builder to allow for command 3311 * chaining. The command itself is returned by the {@link #build()} method. 3312 * See {@link Unix4jCommandBuilder class comments} for more information. 3313 * 3314 * @param options The options defining command behavior. 3315 * @param inputs The inputs. 3316 * @return {@code this} builder to allow for method chaining; method 3317 * chaining is used here to create command chains; adding a command 3318 * to the chain usually means that the previous command <i>pipes</i> 3319 * its output to the next command (the pipe symbol in unix) 3320 */ 3321 @Override 3322 Unix4jCommandBuilder wc(WcOptions options, org.unix4j.io.Input... inputs); 3323 3324 /* ------------------ xargs ------------------ */ 3325 /** 3326 * Reads items from the standard input, delimited by blanks (which can 3327 be protected with double or single quotes or a backslash) or 3328 newlines, and provides variables for the items read from the 3329 standard input. The command following after xargs is executed once 3330 for every input line; the item variables are usually passed to the 3331 invoked command as arguments. 3332 * <p> 3333 * Note that the method returns {@code this} builder to allow for command 3334 * chaining. The command itself is returned by the {@link #build()} method. 3335 * See {@link Unix4jCommandBuilder class comments} for more information. 3336 * 3337 * @return {@code this} builder to allow for method chaining; method 3338 * chaining is used here to create command chains; adding a command 3339 * to the chain usually means that the previous command <i>pipes</i> 3340 * its output to the next command (the pipe symbol in unix) 3341 */ 3342 @Override 3343 Unix4jCommandBuilder xargs(); 3344 /** 3345 * Reads items from the standard input, delimited by blanks and 3346 newlines or a specified delimiter, and provides variables for the 3347 items read from the standard input. The command following after 3348 xargs is executed once for every input line (or for multiple lines 3349 depending on the input options); the item variables are usually 3350 passed to the invoked command as arguments. 3351 <p> 3352 Options can be specified by acronym (with a leading dash "-") or by 3353 long name (with two leading dashes "--"). Operands other than the 3354 default "--maxArgs" operand have to be prefixed with the operand 3355 name. 3356 * <p> 3357 * Note that the method returns {@code this} builder to allow for command 3358 * chaining. The command itself is returned by the {@link #build()} method. 3359 * See {@link Unix4jCommandBuilder class comments} for more information. 3360 * 3361 * @param args String arguments defining the options and operands for the command. 3362 Options can be specified by acronym (with a leading dash "-") or by 3363 long name (with two leading dashes "--"). Operands other than the 3364 default "--maxArgs" operand have to be prefixed with the operand 3365 name (e.g. "--maxLines" for a subsequent line count operand value). 3366 * @return {@code this} builder to allow for method chaining; method 3367 * chaining is used here to create command chains; adding a command 3368 * to the chain usually means that the previous command <i>pipes</i> 3369 * its output to the next command (the pipe symbol in unix) 3370 */ 3371 @Override 3372 Unix4jCommandBuilder xargs(String... args); 3373 /** 3374 * Reads items from the standard input using the specified delimiter to 3375 separate items, and provides variables for the items read from the 3376 standard input. The command following after xargs is executed once 3377 for every input line; the item variables are usually passed to the 3378 invoked command as arguments. 3379 * <p> 3380 * Note that the method returns {@code this} builder to allow for command 3381 * chaining. The command itself is returned by the {@link #build()} method. 3382 * See {@link Unix4jCommandBuilder class comments} for more information. 3383 * 3384 * @param delimiter Input items are terminated by the specified characters. 3385 * @return {@code this} builder to allow for method chaining; method 3386 * chaining is used here to create command chains; adding a command 3387 * to the chain usually means that the previous command <i>pipes</i> 3388 * its output to the next command (the pipe symbol in unix) 3389 */ 3390 @Override 3391 Unix4jCommandBuilder xargs(String delimiter); 3392 /** 3393 * Reads items from the standard input, delimited by blanks (which can 3394 be protected with double or single quotes or a backslash) or 3395 newlines, and provides variables for the items read from the 3396 standard input. The command following after xargs is executed once 3397 for every {@code maxLines} nonblank input lines (or possibly fewer 3398 for the last invocation with the remaining lines at the end of the 3399 file). The item variables are usually passed to the invoked command 3400 as arguments. 3401 * <p> 3402 * Note that the method returns {@code this} builder to allow for command 3403 * chaining. The command itself is returned by the {@link #build()} method. 3404 * See {@link Unix4jCommandBuilder class comments} for more information. 3405 * 3406 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3407 * @return {@code this} builder to allow for method chaining; method 3408 * chaining is used here to create command chains; adding a command 3409 * to the chain usually means that the previous command <i>pipes</i> 3410 * its output to the next command (the pipe symbol in unix) 3411 */ 3412 @Override 3413 Unix4jCommandBuilder xargs(long maxLines); 3414 /** 3415 * Reads items from the standard input, delimited by blanks (which can 3416 be protected with double or single quotes or a backslash) or 3417 newlines, and provides variables for the items read from the 3418 standard input. The command following after xargs is executed once 3419 for every {@code maxArgs} items read from the standard input (or 3420 possibly fewer for the last invocation with the remaining items at 3421 the end of the file). The item variables are usually passed to the 3422 invoked command as arguments. 3423 * <p> 3424 * Note that the method returns {@code this} builder to allow for command 3425 * chaining. The command itself is returned by the {@link #build()} method. 3426 * See {@link Unix4jCommandBuilder class comments} for more information. 3427 * 3428 * @param maxArgs Use at most maxArgs arguments per command invocation. 3429 * @return {@code this} builder to allow for method chaining; method 3430 * chaining is used here to create command chains; adding a command 3431 * to the chain usually means that the previous command <i>pipes</i> 3432 * its output to the next command (the pipe symbol in unix) 3433 */ 3434 @Override 3435 Unix4jCommandBuilder xargs(int maxArgs); 3436 /** 3437 * Reads items from the standard input, delimited by blanks (which can 3438 be protected with double or single quotes or a backslash) or 3439 newlines, and provides variables for the items read from the 3440 standard input. The command following after xargs is executed once 3441 for every {@code maxLines} nonblank input lines or {@code maxArgs} 3442 items (whichever occurs first). Fewer lines or items may be used for 3443 the last invocation with the remaining lines at the end of the file. 3444 The item variables are usually passed to the invoked command as 3445 arguments. 3446 * <p> 3447 * Note that the method returns {@code this} builder to allow for command 3448 * chaining. The command itself is returned by the {@link #build()} method. 3449 * See {@link Unix4jCommandBuilder class comments} for more information. 3450 * 3451 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3452 * @param maxArgs Use at most maxArgs arguments per command invocation. 3453 * @return {@code this} builder to allow for method chaining; method 3454 * chaining is used here to create command chains; adding a command 3455 * to the chain usually means that the previous command <i>pipes</i> 3456 * its output to the next command (the pipe symbol in unix) 3457 */ 3458 @Override 3459 Unix4jCommandBuilder xargs(long maxLines, int maxArgs); 3460 /** 3461 * Reads items from the standard input using the specified delimiter to 3462 separate items, and provides variables for the items read from the 3463 standard input. The command following after xargs is executed once 3464 for every {@code maxLines} nonblank input lines (or possibly fewer 3465 for the last invocation with the remaining lines at the end of the 3466 file). The item variables are usually passed to the invoked command 3467 as arguments. 3468 * <p> 3469 * Note that the method returns {@code this} builder to allow for command 3470 * chaining. The command itself is returned by the {@link #build()} method. 3471 * See {@link Unix4jCommandBuilder class comments} for more information. 3472 * 3473 * @param delimiter Input items are terminated by the specified characters. 3474 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3475 * @return {@code this} builder to allow for method chaining; method 3476 * chaining is used here to create command chains; adding a command 3477 * to the chain usually means that the previous command <i>pipes</i> 3478 * its output to the next command (the pipe symbol in unix) 3479 */ 3480 @Override 3481 Unix4jCommandBuilder xargs(String delimiter, long maxLines); 3482 /** 3483 * Reads items from the standard input using the specified delimiter to 3484 separate items, and provides variables for the items read from the 3485 standard input. The command following after xargs is executed once 3486 for every {@code maxArgs} items read from the standard input (or 3487 possibly fewer for the last invocation with the remaining items at 3488 the end of the file). The item variables are usually passed to the 3489 invoked command as arguments. 3490 * <p> 3491 * Note that the method returns {@code this} builder to allow for command 3492 * chaining. The command itself is returned by the {@link #build()} method. 3493 * See {@link Unix4jCommandBuilder class comments} for more information. 3494 * 3495 * @param delimiter Input items are terminated by the specified characters. 3496 * @param maxArgs Use at most maxArgs arguments per command invocation. 3497 * @return {@code this} builder to allow for method chaining; method 3498 * chaining is used here to create command chains; adding a command 3499 * to the chain usually means that the previous command <i>pipes</i> 3500 * its output to the next command (the pipe symbol in unix) 3501 */ 3502 @Override 3503 Unix4jCommandBuilder xargs(String delimiter, int maxArgs); 3504 /** 3505 * Reads items from the standard input using the specified delimiter to 3506 separate items, and provides variables for the items read from the 3507 standard input. The command following after xargs is executed once 3508 for every {@code maxLines} nonblank input lines or {@code maxArgs} 3509 items (whichever occurs first). Fewer lines or items may be used for 3510 the last invocation with the remaining lines at the end of the file. 3511 The item variables are usually passed to the invoked command as 3512 arguments. 3513 * <p> 3514 * Note that the method returns {@code this} builder to allow for command 3515 * chaining. The command itself is returned by the {@link #build()} method. 3516 * See {@link Unix4jCommandBuilder class comments} for more information. 3517 * 3518 * @param delimiter Input items are terminated by the specified characters. 3519 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3520 * @param maxArgs Use at most maxArgs arguments per command invocation. 3521 * @return {@code this} builder to allow for method chaining; method 3522 * chaining is used here to create command chains; adding a command 3523 * to the chain usually means that the previous command <i>pipes</i> 3524 * its output to the next command (the pipe symbol in unix) 3525 */ 3526 @Override 3527 Unix4jCommandBuilder xargs(String delimiter, long maxLines, int maxArgs); 3528 /** 3529 * Reads items from the standard input using the specified delimiter to 3530 separate items, and provides variables for the items read from the 3531 standard input. If the {@code eof} string occurs as a line of input, 3532 the rest of the input is ignored. The command following after xargs 3533 is executed once for every {@code maxLines} nonblank input lines or 3534 {@code maxArgs} items (whichever occurs first). Fewer lines or items 3535 may be used for the last invocation with the remaining lines at the 3536 end of the file. The item variables are usually passed to the 3537 invoked command as arguments. 3538 * <p> 3539 * Note that the method returns {@code this} builder to allow for command 3540 * chaining. The command itself is returned by the {@link #build()} method. 3541 * See {@link Unix4jCommandBuilder class comments} for more information. 3542 * 3543 * @param delimiter Input items are terminated by the specified characters. 3544 * @param eof If the end of file string occurs as a line of input, the rest of the 3545 input is ignored. 3546 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3547 * @param maxArgs Use at most maxArgs arguments per command invocation. 3548 * @return {@code this} builder to allow for method chaining; method 3549 * chaining is used here to create command chains; adding a command 3550 * to the chain usually means that the previous command <i>pipes</i> 3551 * its output to the next command (the pipe symbol in unix) 3552 */ 3553 @Override 3554 Unix4jCommandBuilder xargs(String delimiter, String eof, long maxLines, int maxArgs); 3555 /** 3556 * Reads items from the standard input, delimited by blanks (which can 3557 be protected with double or single quotes or a backslash) or 3558 newlines, and provides variables for the items read from the 3559 standard input. The command following after xargs is executed once 3560 for every input line; the item variables are usually passed to the 3561 invoked command as arguments. 3562 * <p> 3563 * Note that the method returns {@code this} builder to allow for command 3564 * chaining. The command itself is returned by the {@link #build()} method. 3565 * See {@link Unix4jCommandBuilder class comments} for more information. 3566 * 3567 * @param options The options defining command behavior. 3568 * @return {@code this} builder to allow for method chaining; method 3569 * chaining is used here to create command chains; adding a command 3570 * to the chain usually means that the previous command <i>pipes</i> 3571 * its output to the next command (the pipe symbol in unix) 3572 */ 3573 @Override 3574 Unix4jCommandBuilder xargs(XargsOptions options); 3575 /** 3576 * Reads items from the standard input using the specified delimiter to 3577 separate items, and provides variables for the items read from the 3578 standard input. The command following after xargs is executed once 3579 for every input line; the item variables are usually passed to the 3580 invoked command as arguments. 3581 * <p> 3582 * Note that the method returns {@code this} builder to allow for command 3583 * chaining. The command itself is returned by the {@link #build()} method. 3584 * See {@link Unix4jCommandBuilder class comments} for more information. 3585 * 3586 * @param options The options defining command behavior. 3587 * @param delimiter Input items are terminated by the specified characters. 3588 * @return {@code this} builder to allow for method chaining; method 3589 * chaining is used here to create command chains; adding a command 3590 * to the chain usually means that the previous command <i>pipes</i> 3591 * its output to the next command (the pipe symbol in unix) 3592 */ 3593 @Override 3594 Unix4jCommandBuilder xargs(XargsOptions options, String delimiter); 3595 /** 3596 * Reads items from the standard input, delimited by blanks (which can 3597 be protected with double or single quotes or a backslash) or 3598 newlines, and provides variables for the items read from the 3599 standard input. The command following after xargs is executed once 3600 for every {@code maxLines} nonblank input lines (or possibly fewer 3601 for the last invocation with the remaining lines at the end of the 3602 file). The item variables are usually passed to the invoked command 3603 as arguments. 3604 * <p> 3605 * Note that the method returns {@code this} builder to allow for command 3606 * chaining. The command itself is returned by the {@link #build()} method. 3607 * See {@link Unix4jCommandBuilder class comments} for more information. 3608 * 3609 * @param options The options defining command behavior. 3610 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3611 * @return {@code this} builder to allow for method chaining; method 3612 * chaining is used here to create command chains; adding a command 3613 * to the chain usually means that the previous command <i>pipes</i> 3614 * its output to the next command (the pipe symbol in unix) 3615 */ 3616 @Override 3617 Unix4jCommandBuilder xargs(XargsOptions options, long maxLines); 3618 /** 3619 * Reads items from the standard input, delimited by blanks (which can 3620 be protected with double or single quotes or a backslash) or 3621 newlines, and provides variables for the items read from the 3622 standard input. The command following after xargs is executed once 3623 for every {@code maxArgs} items read from the standard input (or 3624 possibly fewer for the last invocation with the remaining items at 3625 the end of the file). The item variables are usually passed to the 3626 invoked command as arguments. 3627 * <p> 3628 * Note that the method returns {@code this} builder to allow for command 3629 * chaining. The command itself is returned by the {@link #build()} method. 3630 * See {@link Unix4jCommandBuilder class comments} for more information. 3631 * 3632 * @param options The options defining command behavior. 3633 * @param maxArgs Use at most maxArgs arguments per command invocation. 3634 * @return {@code this} builder to allow for method chaining; method 3635 * chaining is used here to create command chains; adding a command 3636 * to the chain usually means that the previous command <i>pipes</i> 3637 * its output to the next command (the pipe symbol in unix) 3638 */ 3639 @Override 3640 Unix4jCommandBuilder xargs(XargsOptions options, int maxArgs); 3641 /** 3642 * Reads items from the standard input, delimited by blanks (which can 3643 be protected with double or single quotes or a backslash) or 3644 newlines, and provides variables for the items read from the 3645 standard input. The command following after xargs is executed once 3646 for every {@code maxLines} nonblank input lines or {@code maxArgs} 3647 items (whichever occurs first). Fewer lines or items may be used for 3648 the last invocation with the remaining lines at the end of the file. 3649 The item variables are usually passed to the invoked command as 3650 arguments. 3651 * <p> 3652 * Note that the method returns {@code this} builder to allow for command 3653 * chaining. The command itself is returned by the {@link #build()} method. 3654 * See {@link Unix4jCommandBuilder class comments} for more information. 3655 * 3656 * @param options The options defining command behavior. 3657 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3658 * @param maxArgs Use at most maxArgs arguments per command invocation. 3659 * @return {@code this} builder to allow for method chaining; method 3660 * chaining is used here to create command chains; adding a command 3661 * to the chain usually means that the previous command <i>pipes</i> 3662 * its output to the next command (the pipe symbol in unix) 3663 */ 3664 @Override 3665 Unix4jCommandBuilder xargs(XargsOptions options, long maxLines, int maxArgs); 3666 /** 3667 * Reads items from the standard input using the specified delimiter to 3668 separate items, and provides variables for the items read from the 3669 standard input. The command following after xargs is executed once 3670 for every {@code maxLines} nonblank input lines (or possibly fewer 3671 for the last invocation with the remaining lines at the end of the 3672 file). The item variables are usually passed to the invoked command 3673 as arguments. 3674 * <p> 3675 * Note that the method returns {@code this} builder to allow for command 3676 * chaining. The command itself is returned by the {@link #build()} method. 3677 * See {@link Unix4jCommandBuilder class comments} for more information. 3678 * 3679 * @param options The options defining command behavior. 3680 * @param delimiter Input items are terminated by the specified characters. 3681 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3682 * @return {@code this} builder to allow for method chaining; method 3683 * chaining is used here to create command chains; adding a command 3684 * to the chain usually means that the previous command <i>pipes</i> 3685 * its output to the next command (the pipe symbol in unix) 3686 */ 3687 @Override 3688 Unix4jCommandBuilder xargs(XargsOptions options, String delimiter, long maxLines); 3689 /** 3690 * Reads items from the standard input using the specified delimiter to 3691 separate items, and provides variables for the items read from the 3692 standard input. The command following after xargs is executed once 3693 for every {@code maxArgs} items read from the standard input (or 3694 possibly fewer for the last invocation with the remaining items at 3695 the end of the file). The item variables are usually passed to the 3696 invoked command as arguments. 3697 * <p> 3698 * Note that the method returns {@code this} builder to allow for command 3699 * chaining. The command itself is returned by the {@link #build()} method. 3700 * See {@link Unix4jCommandBuilder class comments} for more information. 3701 * 3702 * @param options The options defining command behavior. 3703 * @param delimiter Input items are terminated by the specified characters. 3704 * @param maxArgs Use at most maxArgs arguments per command invocation. 3705 * @return {@code this} builder to allow for method chaining; method 3706 * chaining is used here to create command chains; adding a command 3707 * to the chain usually means that the previous command <i>pipes</i> 3708 * its output to the next command (the pipe symbol in unix) 3709 */ 3710 @Override 3711 Unix4jCommandBuilder xargs(XargsOptions options, String delimiter, int maxArgs); 3712 /** 3713 * Reads items from the standard input using the specified delimiter to 3714 separate items, and provides variables for the items read from the 3715 standard input. The command following after xargs is executed once 3716 for every {@code maxLines} nonblank input lines or {@code maxArgs} 3717 items (whichever occurs first). Fewer lines or items may be used for 3718 the last invocation with the remaining lines at the end of the file. 3719 The item variables are usually passed to the invoked command as 3720 arguments. 3721 * <p> 3722 * Note that the method returns {@code this} builder to allow for command 3723 * chaining. The command itself is returned by the {@link #build()} method. 3724 * See {@link Unix4jCommandBuilder class comments} for more information. 3725 * 3726 * @param options The options defining command behavior. 3727 * @param delimiter Input items are terminated by the specified characters. 3728 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3729 * @param maxArgs Use at most maxArgs arguments per command invocation. 3730 * @return {@code this} builder to allow for method chaining; method 3731 * chaining is used here to create command chains; adding a command 3732 * to the chain usually means that the previous command <i>pipes</i> 3733 * its output to the next command (the pipe symbol in unix) 3734 */ 3735 @Override 3736 Unix4jCommandBuilder xargs(XargsOptions options, String delimiter, long maxLines, int maxArgs); 3737 /** 3738 * Reads items from the standard input using the specified delimiter to 3739 separate items, and provides variables for the items read from the 3740 standard input. If the {@code eof} string occurs as a line of input, 3741 the rest of the input is ignored. The command following after xargs 3742 is executed once for every {@code maxLines} nonblank input lines or 3743 {@code maxArgs} items (whichever occurs first). Fewer lines or items 3744 may be used for the last invocation with the remaining lines at the 3745 end of the file. The item variables are usually passed to the 3746 invoked command as arguments. 3747 * <p> 3748 * Note that the method returns {@code this} builder to allow for command 3749 * chaining. The command itself is returned by the {@link #build()} method. 3750 * See {@link Unix4jCommandBuilder class comments} for more information. 3751 * 3752 * @param options The options defining command behavior. 3753 * @param delimiter Input items are terminated by the specified characters. 3754 * @param eof If the end of file string occurs as a line of input, the rest of the 3755 input is ignored. 3756 * @param maxLines Use at most maxLines nonblank input lines per command invocation. 3757 * @param maxArgs Use at most maxArgs arguments per command invocation. 3758 * @return {@code this} builder to allow for method chaining; method 3759 * chaining is used here to create command chains; adding a command 3760 * to the chain usually means that the previous command <i>pipes</i> 3761 * its output to the next command (the pipe symbol in unix) 3762 */ 3763 @Override 3764 Unix4jCommandBuilder xargs(XargsOptions options, String delimiter, String eof, long maxLines, int maxArgs); 3765 3766 //override with specialized return type 3767 @Override 3768 Unix4jCommandBuilder join(Command<?> command); 3769 3770 //override with specialized return type 3771 @Override 3772 Unix4jCommandBuilder apply(LineOperation operation); 3773 3774 //override with specialized return type 3775 @Override 3776 Unix4jCommandBuilder reset(); 3777 3778}