001package org.unix4j; 002 003import org.unix4j.unix.Unix4jCommandBuilder; 004import org.unix4j.unix.DefaultUnix4jCommandBuilder; 005import org.unix4j.command.NoOp; 006import org.unix4j.context.ExecutionContextFactory; 007 008import org.unix4j.unix.cat.CatOptions; 009import org.unix4j.unix.echo.EchoOptions; 010import org.unix4j.unix.find.FindOptions; 011import org.unix4j.unix.grep.GrepOptions; 012import org.unix4j.unix.head.HeadOptions; 013import org.unix4j.unix.ls.LsOptions; 014import org.unix4j.unix.sed.SedOptions; 015import org.unix4j.unix.sort.SortOptions; 016import org.unix4j.unix.tail.TailOptions; 017import org.unix4j.unix.uniq.UniqOptions; 018import org.unix4j.unix.wc.WcOptions; 019 020/** 021 * Utility class with static methods serving as starting point to create a 022 * command or build a command chain joining several commands. 023 * <p> 024 * Every method returns a new builder instance. For more information and a 025 * detailed description of command building and chaining, see 026 * {@link Unix4jCommandBuilder}. 027 */ 028public final class Unix4j { 029 030 /** 031 * Returns a builder to create a command or command chain. The builder is 032 * initialized with a {@link NoOp} command which will be replaced by the 033 * first command joined to this builder's command chain. 034 * 035 * @return the builder to create the command or command chain 036 */ 037 public static Unix4jCommandBuilder builder() { 038 return new DefaultUnix4jCommandBuilder(); 039 } 040 041 /** 042 * Returns a builder that uses the specified factory to create contexts for 043 * command execution. The builder is initialized with a {@link NoOp} command 044 * which will be replaced by the first command joined to this builder's 045 * command chain. 046 * 047 * @param contextFactory 048 * the factory used to create execution contexts that are passed 049 * to the execute method when a command is executed 050 * @return the builder to create the command or command chain 051 */ 052 public static Unix4jCommandBuilder use(ExecutionContextFactory contextFactory) { 053 return new DefaultUnix4jCommandBuilder(contextFactory); 054 } 055 056 /** 057 * Reads the lines from files specified as arguments and writes them to 058 the standard output. Options can be specified by acronym (with a 059 leading dash "-") or by long name (with two leading dashes "--"). 060 File arguments are expanded if wildcards are used. All file 061 arguments are processed in command-argument order. 062 * <p> 063 * Note that the method returns the command builder to allow for command 064 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 065 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 066 * 067 * @param args String arguments defining the options and file operands for the 068 command. Options can be specified by acronym (with a leading dash 069 "-") or by long name (with two leading dashes "--"). File arguments 070 are expanded if wildcards are used. 071 * @return the command builder to allow for method chaining. Method 072 * chaining is used here to create command chains. Adding a command 073 * to the chain usually means that the previous command <i>pipes</i> 074 * its output to the added command (the pipe symbol in unix) 075 */ 076 public static Unix4jCommandBuilder cat(String... args) { 077 return builder().cat(args); 078 } 079 /** 080 * Reads the lines from the specified files and writes them to the 081 standard output. The files are processed in command-argument order. 082 * <p> 083 * Note that the method returns the command builder to allow for command 084 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 085 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 086 * 087 * @param files The input files to be printed; relative paths are not resolved (use 088 the string path argument to enable relative path resolving based on 089 the current working directory). 090 * @return the command builder to allow for method chaining. Method 091 * chaining is used here to create command chains. Adding a command 092 * to the chain usually means that the previous command <i>pipes</i> 093 * its output to the added command (the pipe symbol in unix) 094 */ 095 public static Unix4jCommandBuilder cat(java.io.File... files) { 096 return builder().cat(files); 097 } 098 /** 099 * Reads the lines from the specified inputs and writes them to the 100 standard output. The inputs are processed in command-argument order. 101 * <p> 102 * Note that the method returns the command builder to allow for command 103 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 104 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 105 * 106 * @param inputs The inputs to be printed. 107 * @return the command builder to allow for method chaining. Method 108 * chaining is used here to create command chains. Adding a command 109 * to the chain usually means that the previous command <i>pipes</i> 110 * its output to the added command (the pipe symbol in unix) 111 */ 112 public static Unix4jCommandBuilder cat(org.unix4j.io.Input... inputs) { 113 return builder().cat(inputs); 114 } 115 /** 116 * Reads the lines from the specified files and writes them to the 117 standard output; the given options define the details of the output 118 format. The files are processed in command-argument order. 119 * <p> 120 * Note that the method returns the command builder to allow for command 121 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 122 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 123 * 124 * @param options Options for the cat command. 125 * @param files The input files to be printed; relative paths are not resolved (use 126 the string path argument to enable relative path resolving based on 127 the current working directory). 128 * @return the command builder to allow for method chaining. Method 129 * chaining is used here to create command chains. Adding a command 130 * to the chain usually means that the previous command <i>pipes</i> 131 * its output to the added command (the pipe symbol in unix) 132 */ 133 public static Unix4jCommandBuilder cat(CatOptions options, java.io.File... files) { 134 return builder().cat(options, files); 135 } 136 /** 137 * Reads the lines from the specified files and writes them to the 138 standard output; the given options define the details of the output 139 format. The path arguments are expanded if wildcards are used and 140 processed in command-argument order. 141 * <p> 142 * Note that the method returns the command builder to allow for command 143 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 144 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 145 * 146 * @param options Options for the cat command. 147 * @param paths Path names of the input files to be printed; wildcards * and ? are 148 supported; relative paths are resolved on the basis of the current 149 working directory. 150 * @return the command builder to allow for method chaining. Method 151 * chaining is used here to create command chains. Adding a command 152 * to the chain usually means that the previous command <i>pipes</i> 153 * its output to the added command (the pipe symbol in unix) 154 */ 155 public static Unix4jCommandBuilder cat(CatOptions options, String... paths) { 156 return builder().cat(options, paths); 157 } 158 /** 159 * Reads the lines from the specified inputs and writes them to the 160 standard output; the given options define the details of the output 161 format. The inputs are processed in command-argument order. 162 * <p> 163 * Note that the method returns the command builder to allow for command 164 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 165 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 166 * 167 * @param options Options for the cat command. 168 * @param inputs The inputs to be printed. 169 * @return the command builder to allow for method chaining. Method 170 * chaining is used here to create command chains. Adding a command 171 * to the chain usually means that the previous command <i>pipes</i> 172 * its output to the added command (the pipe symbol in unix) 173 */ 174 public static Unix4jCommandBuilder cat(CatOptions options, org.unix4j.io.Input... inputs) { 175 return builder().cat(options, inputs); 176 } 177 /** 178 * Changes the current directory to the user home directory as defined 179 by the execution context (usually the directory specified by the 180 {@code "user.home"} system property). 181 * <p> 182 * Note that the method returns the command builder to allow for command 183 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 184 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 185 * 186 * @return the command builder to allow for method chaining. Method 187 * chaining is used here to create command chains. Adding a command 188 * to the chain usually means that the previous command <i>pipes</i> 189 * its output to the added command (the pipe symbol in unix) 190 */ 191 public static Unix4jCommandBuilder cd() { 192 return builder().cd(); 193 } 194 /** 195 * The current working directory is changed to the given file. If the 196 specified file argument does not represent a valid directory, an 197 exception is thrown. Note that relative paths are not resolved with 198 the (old) current working directory. Use the String path to enable 199 relative path resolving and wildcards. 200 * <p> 201 * Note that the method returns the command builder to allow for command 202 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 203 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 204 * 205 * @param file the file to use as input; relative paths are not resolved (use the 206 string path argument to enable relative path resolving based on the 207 current working directory). 208 * @return the command builder to allow for method chaining. Method 209 * chaining is used here to create command chains. Adding a command 210 * to the chain usually means that the previous command <i>pipes</i> 211 * its output to the added command (the pipe symbol in unix) 212 */ 213 public static Unix4jCommandBuilder cd(java.io.File file) { 214 return builder().cd(file); 215 } 216 /** 217 * The current working directory is changed to the given file. Relative 218 paths are resolved on the basis of the (old) current working 219 directory. Wildcards are possible if the first matching file 220 represents a directory. If the first file specified by the given 221 path argument is not a valid directory, an exception is thrown. 222 * <p> 223 * Note that the method returns the command builder to allow for command 224 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 225 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 226 * 227 * @param path the directory to become the new current working directory; 228 wildcards * and ? are supported; relative paths are resolved on the 229 basis of the current working directory. 230 * @return the command builder to allow for method chaining. Method 231 * chaining is used here to create command chains. Adding a command 232 * to the chain usually means that the previous command <i>pipes</i> 233 * its output to the added command (the pipe symbol in unix) 234 */ 235 public static Unix4jCommandBuilder cd(String path) { 236 return builder().cd(path); 237 } 238 /** 239 * Writes any of the specified strings, separated by single blank 240 ({@code ' '}) characters to the standard output suppressing the 241 trailing line ending if the {@code "-n"} option is specified. 242 * <p> 243 * Note that the method returns the command builder to allow for command 244 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 245 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 246 * 247 * @param args String arguments defining the options for the command and the 248 strings to be written to the output. Options can be specified by 249 acronym (with a leading dash "-") or by long name (with two leading 250 dashes "--"). 251 * @return the command builder to allow for method chaining. Method 252 * chaining is used here to create command chains. Adding a command 253 * to the chain usually means that the previous command <i>pipes</i> 254 * its output to the added command (the pipe symbol in unix) 255 */ 256 public static Unix4jCommandBuilder echo(String... args) { 257 return builder().echo(args); 258 } 259 /** 260 * Writes the specified string followed by a newline character to 261 the standard output suppressing the trailing line ending if the 262 {@code -n} option is specified. 263 * <p> 264 * Note that the method returns the command builder to allow for command 265 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 266 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 267 * 268 * @param options Options for the echo command. 269 * @param string A string to be written to standard output. 270 * @return the command builder to allow for method chaining. Method 271 * chaining is used here to create command chains. Adding a command 272 * to the chain usually means that the previous command <i>pipes</i> 273 * its output to the added command (the pipe symbol in unix) 274 */ 275 public static Unix4jCommandBuilder echo(EchoOptions options, String string) { 276 return builder().echo(options, string); 277 } 278 /** 279 * Writes any of the specified strings, separated by single blank 280 ({@code ' '}) characters to the standard output suppressing the 281 trailing line ending if the {@code -n} option is specified. 282 * <p> 283 * Note that the method returns the command builder to allow for command 284 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 285 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 286 * 287 * @param options Options for the echo command. 288 * @param strings Strings to be written to standard output, separated by single blank 289 characters. 290 * @return the command builder to allow for method chaining. Method 291 * chaining is used here to create command chains. Adding a command 292 * to the chain usually means that the previous command <i>pipes</i> 293 * its output to the added command (the pipe symbol in unix) 294 */ 295 public static Unix4jCommandBuilder echo(EchoOptions options, String... strings) { 296 return builder().echo(options, strings); 297 } 298 /** 299 * Finds all files matching the search criteria specified by the given 300 arguments and writes the file names to the standard output. 301 <p> 302 Options can be specified by acronym (with a leading dash "-") or by 303 long name (with two leading dashes "--"). Operands other than the 304 default "--name" operand have to be prefixed with the operand name. 305 <p> 306 The files names written to the output are relative paths referring 307 to the working directory (or -- if provided -- relative to the path 308 given after the {@code "--path"} operand name). 309 * <p> 310 * Note that the method returns the command builder to allow for command 311 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 312 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 313 * 314 * @param args String arguments defining the options and operands for the command. 315 Options can be specified by acronym (with a leading dash "-") or by 316 long name (with two leading dashes "--"). Operands other than the 317 default "--path" operand have to be prefixed with the operand name 318 (e.g. "--name" for subsequent path operand values). 319 * @return the command builder to allow for method chaining. Method 320 * chaining is used here to create command chains. Adding a command 321 * to the chain usually means that the previous command <i>pipes</i> 322 * its output to the added command (the pipe symbol in unix) 323 */ 324 public static Unix4jCommandBuilder find(String... args) { 325 return builder().find(args); 326 } 327 /** 328 * Finds all files in or below the directory specified by {@code path} 329 and writes the file names to the standard output. 330<p> 331 The files names written to the output are paths relative to the 332 specified {@code path} operand. 333 * <p> 334 * Note that the method returns the command builder to allow for command 335 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 336 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 337 * 338 * @param path Starting point for the search in the directory hierarchy; 339 wildcards * and ? are supported; relative paths are resolved on the 340 basis of the current working directory. 341 * @return the command builder to allow for method chaining. Method 342 * chaining is used here to create command chains. Adding a command 343 * to the chain usually means that the previous command <i>pipes</i> 344 * its output to the added command (the pipe symbol in unix) 345 */ 346 public static Unix4jCommandBuilder find(String path) { 347 return builder().find(path); 348 } 349 /** 350 * Finds all files matching the specified {@code name} in or below the 351 directory specified by {@code path} and writes the file names to 352 the standard output. 353 <p> 354 The files names written to the output are paths relative to the 355 specified {@code path} operand. 356 * <p> 357 * Note that the method returns the command builder to allow for command 358 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 359 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 360 * 361 * @param path Starting point for the search in the directory hierarchy; 362 wildcards * and ? are supported; relative paths are resolved on the 363 basis of the current working directory. 364 * @param name Name pattern to match the file name after removing the path with the 365 leading directories; wildcards * and ? are supported, or full 366 regular expressions if either of the options {@code -regex (-r)} or 367 {@code -iregex (-i)} is specified. 368 * @return the command builder to allow for method chaining. Method 369 * chaining is used here to create command chains. Adding a command 370 * to the chain usually means that the previous command <i>pipes</i> 371 * its output to the added command (the pipe symbol in unix) 372 */ 373 public static Unix4jCommandBuilder find(String path, String name) { 374 return builder().find(path, name); 375 } 376 /** 377 * Finds all files matching the specified file {@code size} in or below 378 the user's current working directory and writes the file names to 379 the standard output. Matching files use at least {@code size} bytes 380 on disk if {@code size} is positive, or at most {@code abs(size)} 381 bytes if {@code size} is zero or negative. 382 <p> 383 The files names written to the output are relative paths referring 384 to the working directory. 385 * <p> 386 * Note that the method returns the command builder to allow for command 387 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 388 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 389 * 390 * @param size Consider only files using at least {@code size} bytes if {@code size} 391 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 392 or negative. 393 * @return the command builder to allow for method chaining. Method 394 * chaining is used here to create command chains. Adding a command 395 * to the chain usually means that the previous command <i>pipes</i> 396 * its output to the added command (the pipe symbol in unix) 397 */ 398 public static Unix4jCommandBuilder find(long size) { 399 return builder().find(size); 400 } 401 /** 402 * Finds all files matching the specified file {@code size} in or below 403 the directory specified by {@code path} and writes the file names 404 to the standard output. Matching files use at least {@code size} 405 bytes on disk if {@code size} is positive, or at most 406 {@code abs(size)} bytes if {@code size} is zero or negative. 407<p> 408 The files names written to the output are paths relative to the 409 specified {@code path} operand. 410 * <p> 411 * Note that the method returns the command builder to allow for command 412 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 413 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 414 * 415 * @param path Starting point for the search in the directory hierarchy; 416 wildcards * and ? are supported; relative paths are resolved on the 417 basis of the current working directory. 418 * @param size Consider only files using at least {@code size} bytes if {@code size} 419 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 420 or negative. 421 * @return the command builder to allow for method chaining. Method 422 * chaining is used here to create command chains. Adding a command 423 * to the chain usually means that the previous command <i>pipes</i> 424 * its output to the added command (the pipe symbol in unix) 425 */ 426 public static Unix4jCommandBuilder find(String path, long size) { 427 return builder().find(path, size); 428 } 429 /** 430 * Finds all files matching the specified file {@code name} and 431 {@code size} in or below the user's current working directory and 432 writes the file names to the standard output. Matching files use 433 at least {@code size} bytes on disk if {@code size} is positive, 434 or at most {@code abs(size)} bytes if {@code size} is zero or 435 negative. 436<p> 437 The files names written to the output are relative paths referring 438 to the working directory. 439 * <p> 440 * Note that the method returns the command builder to allow for command 441 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 442 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 443 * 444 * @param size Consider only files using at least {@code size} bytes if {@code size} 445 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 446 or negative. 447 * @param name Name pattern to match the file name after removing the path with the 448 leading directories; wildcards * and ? are supported, or full 449 regular expressions if either of the options {@code -regex (-r)} or 450 {@code -iregex (-i)} is specified. 451 * @return the command builder to allow for method chaining. Method 452 * chaining is used here to create command chains. Adding a command 453 * to the chain usually means that the previous command <i>pipes</i> 454 * its output to the added command (the pipe symbol in unix) 455 */ 456 public static Unix4jCommandBuilder find(long size, String name) { 457 return builder().find(size, name); 458 } 459 /** 460 * Finds all files matching the specified file {@code name} and 461 {@code size} in or below the directory specified by {@code path} 462 and writes the file names to the standard output. Matching files 463 use at least {@code size} bytes on disk if {@code size} is positive, 464 or at most {@code abs(size)} bytes if {@code size} is zero or 465 negative. 466<p> 467 The files names written to the output are paths relative to the 468 specified {@code path} operand. 469 * <p> 470 * Note that the method returns the command builder to allow for command 471 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 472 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 473 * 474 * @param path Starting point for the search in the directory hierarchy; 475 wildcards * and ? are supported; relative paths are resolved on the 476 basis of the current working directory. 477 * @param size Consider only files using at least {@code size} bytes if {@code size} 478 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 479 or negative. 480 * @param name Name pattern to match the file name after removing the path with the 481 leading directories; wildcards * and ? are supported, or full 482 regular expressions if either of the options {@code -regex (-r)} or 483 {@code -iregex (-i)} is specified. 484 * @return the command builder to allow for method chaining. Method 485 * chaining is used here to create command chains. Adding a command 486 * to the chain usually means that the previous command <i>pipes</i> 487 * its output to the added command (the pipe symbol in unix) 488 */ 489 public static Unix4jCommandBuilder find(String path, long size, String name) { 490 return builder().find(path, size, name); 491 } 492 /** 493 * Finds all files matching the specified {@code name} in or below the 494 user's current working directory and writes the file names to the 495 standard output. 496 <p> 497 The files names written to the output are relative paths referring 498 to the working directory. 499 * <p> 500 * Note that the method returns the command builder to allow for command 501 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 502 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 503 * 504 * @param options Options for the file search. 505 * @param name Name pattern to match the file name after removing the path with the 506 leading directories; wildcards * and ? are supported, or full 507 regular expressions if either of the options {@code -regex (-r)} or 508 {@code -iregex (-i)} is specified. 509 * @return the command builder to allow for method chaining. Method 510 * chaining is used here to create command chains. Adding a command 511 * to the chain usually means that the previous command <i>pipes</i> 512 * its output to the added command (the pipe symbol in unix) 513 */ 514 public static Unix4jCommandBuilder find(FindOptions options, String name) { 515 return builder().find(options, name); 516 } 517 /** 518 * Finds all files matching the specified {@code name} in or below the 519 directory specified by {@code path} and writes the file names to 520 the standard output. 521<p> 522 The files names written to the output are paths relative to the 523 specified {@code path} operand. 524 * <p> 525 * Note that the method returns the command builder to allow for command 526 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 527 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 528 * 529 * @param options Options for the file search. 530 * @param path Starting point for the search in the directory hierarchy; 531 wildcards * and ? are supported; relative paths are resolved on the 532 basis of the current working directory. 533 * @param name Name pattern to match the file name after removing the path with the 534 leading directories; wildcards * and ? are supported, or full 535 regular expressions if either of the options {@code -regex (-r)} or 536 {@code -iregex (-i)} is specified. 537 * @return the command builder to allow for method chaining. Method 538 * chaining is used here to create command chains. Adding a command 539 * to the chain usually means that the previous command <i>pipes</i> 540 * its output to the added command (the pipe symbol in unix) 541 */ 542 public static Unix4jCommandBuilder find(FindOptions options, String path, String name) { 543 return builder().find(options, path, name); 544 } 545 /** 546 * Finds all files matching the specified file {@code size} in or below 547 the user's current working directory and writes the file names to 548 the standard output. Matching files use at least {@code size} bytes 549 on disk if {@code size} is positive, or at most {@code abs(size)} 550 bytes if {@code size} is zero or negative. 551<p> 552 The files names written to the output are relative paths referring 553 to the working directory. 554 * <p> 555 * Note that the method returns the command builder to allow for command 556 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 557 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 558 * 559 * @param options Options for the file search. 560 * @param size Consider only files using at least {@code size} bytes if {@code size} 561 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 562 or negative. 563 * @return the command builder to allow for method chaining. Method 564 * chaining is used here to create command chains. Adding a command 565 * to the chain usually means that the previous command <i>pipes</i> 566 * its output to the added command (the pipe symbol in unix) 567 */ 568 public static Unix4jCommandBuilder find(FindOptions options, long size) { 569 return builder().find(options, size); 570 } 571 /** 572 * Finds all files matching the specified file {@code size} in or below 573 the directory specified by {@code path} and writes the file names 574 to the standard output. Matching files use at least {@code size} 575 bytes on disk if {@code size} is positive, or at most 576 {@code abs(size)} bytes if {@code size} is zero or negative. 577<p> 578 The files names written to the output are paths relative to the 579 specified {@code path} operand. 580 * <p> 581 * Note that the method returns the command builder to allow for command 582 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 583 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 584 * 585 * @param options Options for the file search. 586 * @param path Starting point for the search in the directory hierarchy; 587 wildcards * and ? are supported; relative paths are resolved on the 588 basis of the current working directory. 589 * @param size Consider only files using at least {@code size} bytes if {@code size} 590 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 591 or negative. 592 * @return the command builder to allow for method chaining. Method 593 * chaining is used here to create command chains. Adding a command 594 * to the chain usually means that the previous command <i>pipes</i> 595 * its output to the added command (the pipe symbol in unix) 596 */ 597 public static Unix4jCommandBuilder find(FindOptions options, String path, long size) { 598 return builder().find(options, path, size); 599 } 600 /** 601 * Finds all files that have been created, modified or accessed before 602 or after the specified {@code time} (depending on the given 603 {@code -time...} options). The names of the matching files found in 604 or below the user's current working directory are written to the 605 standard output. 606<p> 607 The files names written to the output are relative paths referring 608 to the working directory. 609 * <p> 610 * Note that the method returns the command builder to allow for command 611 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 612 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 613 * 614 * @param options Options for the file search. 615 * @param time Consider only files that have been created, modified or accessed 616 before or after the specified {@code time} operand; consider the 617 {@code -time...} options for details of the comparison. 618 * @return the command builder to allow for method chaining. Method 619 * chaining is used here to create command chains. Adding a command 620 * to the chain usually means that the previous command <i>pipes</i> 621 * its output to the added command (the pipe symbol in unix) 622 */ 623 public static Unix4jCommandBuilder find(FindOptions options, java.util.Date time) { 624 return builder().find(options, time); 625 } 626 /** 627 * Finds all files that have been created, modified or accessed before 628 or after the specified {@code time} (depending on the given 629 {@code -time...} options). The names of the matching files found in 630 or below the directory specified by {@code path} are written to 631 the standard output. 632<p> 633 The files names written to the output are paths relative to the 634 specified {@code path} operand. 635 * <p> 636 * Note that the method returns the command builder to allow for command 637 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 638 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 639 * 640 * @param options Options for the file search. 641 * @param path Starting point for the search in the directory hierarchy; 642 wildcards * and ? are supported; relative paths are resolved on the 643 basis of the current working directory. 644 * @param time Consider only files that have been created, modified or accessed 645 before or after the specified {@code time} operand; consider the 646 {@code -time...} options for details of the comparison. 647 * @return the command builder to allow for method chaining. Method 648 * chaining is used here to create command chains. Adding a command 649 * to the chain usually means that the previous command <i>pipes</i> 650 * its output to the added command (the pipe symbol in unix) 651 */ 652 public static Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time) { 653 return builder().find(options, path, time); 654 } 655 /** 656 * Finds all files matching the specified file {@code name} and 657 {@code size} in or below the user's current working directory and 658 writes the file names to the standard output. Matching files use 659 at least {@code size} bytes on disk if {@code size} is positive, or 660 at most {@code abs(size)} bytes if {@code size} is zero or negative. 661<p> 662 The files names written to the output are relative paths referring 663 to the working directory. 664 * <p> 665 * Note that the method returns the command builder to allow for command 666 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 667 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 668 * 669 * @param options Options for the file search. 670 * @param size Consider only files using at least {@code size} bytes if {@code size} 671 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 672 or negative. 673 * @param name Name pattern to match the file name after removing the path with the 674 leading directories; wildcards * and ? are supported, or full 675 regular expressions if either of the options {@code -regex (-r)} or 676 {@code -iregex (-i)} is specified. 677 * @return the command builder to allow for method chaining. Method 678 * chaining is used here to create command chains. Adding a command 679 * to the chain usually means that the previous command <i>pipes</i> 680 * its output to the added command (the pipe symbol in unix) 681 */ 682 public static Unix4jCommandBuilder find(FindOptions options, long size, String name) { 683 return builder().find(options, size, name); 684 } 685 /** 686 * Finds all files matching the specified file {@code name} and 687 {@code size} in or below the directory specified by {@code path} 688 and writes the file names to the standard output. Matching files 689 use at least {@code size} bytes on disk if {@code size} is positive, 690 or at most {@code abs(size)} bytes if {@code size} is zero or 691 negative. 692<p> 693 The files names written to the output are paths relative to the 694 specified {@code path} operand. 695 * <p> 696 * Note that the method returns the command builder to allow for command 697 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 698 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 699 * 700 * @param options Options for the file search. 701 * @param path Starting point for the search in the directory hierarchy; 702 wildcards * and ? are supported; relative paths are resolved on the 703 basis of the current working directory. 704 * @param size Consider only files using at least {@code size} bytes if {@code size} 705 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 706 or negative. 707 * @param name Name pattern to match the file name after removing the path with the 708 leading directories; wildcards * and ? are supported, or full 709 regular expressions if either of the options {@code -regex (-r)} or 710 {@code -iregex (-i)} is specified. 711 * @return the command builder to allow for method chaining. Method 712 * chaining is used here to create command chains. Adding a command 713 * to the chain usually means that the previous command <i>pipes</i> 714 * its output to the added command (the pipe symbol in unix) 715 */ 716 public static Unix4jCommandBuilder find(FindOptions options, String path, long size, String name) { 717 return builder().find(options, path, size, name); 718 } 719 /** 720 * Finds all files matching the given {@code name} that have been 721 created, modified or accessed before or after the specified 722 {@code time} (depending on the given {@code -time...} options). The 723 names of the matching files found in or below the user's current 724 working directory are written to the standard output. 725<p> 726 The files names written to the output are relative paths referring 727 to the working directory. 728 * <p> 729 * Note that the method returns the command builder to allow for command 730 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 731 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 732 * 733 * @param options Options for the file search. 734 * @param time Consider only files that have been created, modified or accessed 735 before or after the specified {@code time} operand; consider the 736 {@code -time...} options for details of the comparison. 737 * @param name Name pattern to match the file name after removing the path with the 738 leading directories; wildcards * and ? are supported, or full 739 regular expressions if either of the options {@code -regex (-r)} or 740 {@code -iregex (-i)} is specified. 741 * @return the command builder to allow for method chaining. Method 742 * chaining is used here to create command chains. Adding a command 743 * to the chain usually means that the previous command <i>pipes</i> 744 * its output to the added command (the pipe symbol in unix) 745 */ 746 public static Unix4jCommandBuilder find(FindOptions options, java.util.Date time, String name) { 747 return builder().find(options, time, name); 748 } 749 /** 750 * Finds all files matching the given {@code name} that have been 751 created, modified or accessed before or after the specified 752 {@code time} (depending on the given {@code -time...} options). The 753 names of the matching files found in or below the directory 754 specified by {@code path} are written to the standard output. 755<p> 756 The files names written to the output are paths relative to the 757 specified {@code path} operand. 758 * <p> 759 * Note that the method returns the command builder to allow for command 760 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 761 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 762 * 763 * @param options Options for the file search. 764 * @param path Starting point for the search in the directory hierarchy; 765 wildcards * and ? are supported; relative paths are resolved on the 766 basis of the current working directory. 767 * @param time Consider only files that have been created, modified or accessed 768 before or after the specified {@code time} operand; consider the 769 {@code -time...} options for details of the comparison. 770 * @param name Name pattern to match the file name after removing the path with the 771 leading directories; wildcards * and ? are supported, or full 772 regular expressions if either of the options {@code -regex (-r)} or 773 {@code -iregex (-i)} is specified. 774 * @return the command builder to allow for method chaining. Method 775 * chaining is used here to create command chains. Adding a command 776 * to the chain usually means that the previous command <i>pipes</i> 777 * its output to the added command (the pipe symbol in unix) 778 */ 779 public static Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time, String name) { 780 return builder().find(options, path, time, name); 781 } 782 /** 783 * Finds all files matching the given {@code name} and {@code size} and 784 have been created, modified or accessed before or after the specified 785 {@code time} (depending on the given {@code -time...} options). 786 <p> 787 Matching files use at least {@code size} bytes on disk if 788 {@code size} is positive, or at most {@code abs(size)} bytes if 789 {@code size} is zero or negative. The names of the matching files 790 found in or below the user's current working directory are written 791 to the standard output. 792<p> 793 The files names written to the output are relative paths referring 794 to the working directory. 795 * <p> 796 * Note that the method returns the command builder to allow for command 797 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 798 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 799 * 800 * @param options Options for the file search. 801 * @param size Consider only files using at least {@code size} bytes if {@code size} 802 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 803 or negative. 804 * @param time Consider only files that have been created, modified or accessed 805 before or after the specified {@code time} operand; consider the 806 {@code -time...} options for details of the comparison. 807 * @param name Name pattern to match the file name after removing the path with the 808 leading directories; wildcards * and ? are supported, or full 809 regular expressions if either of the options {@code -regex (-r)} or 810 {@code -iregex (-i)} is specified. 811 * @return the command builder to allow for method chaining. Method 812 * chaining is used here to create command chains. Adding a command 813 * to the chain usually means that the previous command <i>pipes</i> 814 * its output to the added command (the pipe symbol in unix) 815 */ 816 public static Unix4jCommandBuilder find(FindOptions options, long size, java.util.Date time, String name) { 817 return builder().find(options, size, time, name); 818 } 819 /** 820 * Finds all files matching the given {@code name} and {@code size} and 821 have been created, modified or accessed before or after the specified 822 {@code time} (depending on the given {@code -time...} options). 823 <p> 824 Matching files use at least {@code size} bytes on disk if 825 {@code size} is positive, or at most {@code abs(size)} bytes if 826 {@code size} is zero or negative. The names of the matching files 827 found in or below the directory specified by {@code path} are 828 written to the standard output. 829<p> 830 The files names written to the output are paths relative to the 831 specified {@code path} operand. 832 * <p> 833 * Note that the method returns the command builder to allow for command 834 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 835 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 836 * 837 * @param options Options for the file search. 838 * @param path Starting point for the search in the directory hierarchy; 839 wildcards * and ? are supported; relative paths are resolved on the 840 basis of the current working directory. 841 * @param size Consider only files using at least {@code size} bytes if {@code size} 842 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 843 or negative. 844 * @param time Consider only files that have been created, modified or accessed 845 before or after the specified {@code time} operand; consider the 846 {@code -time...} options for details of the comparison. 847 * @param name Name pattern to match the file name after removing the path with the 848 leading directories; wildcards * and ? are supported, or full 849 regular expressions if either of the options {@code -regex (-r)} or 850 {@code -iregex (-i)} is specified. 851 * @return the command builder to allow for method chaining. Method 852 * chaining is used here to create command chains. Adding a command 853 * to the chain usually means that the previous command <i>pipes</i> 854 * its output to the added command (the pipe symbol in unix) 855 */ 856 public static Unix4jCommandBuilder find(FindOptions options, String path, long size, java.util.Date time, String name) { 857 return builder().find(options, path, size, time, name); 858 } 859 /** 860 * Uses the given string as input for the next command. If the string 861 contains line ending codes (UNIX or DOS independent from the host 862 operating system), the string is split into multiple lines. 863 * <p> 864 * Note that the method returns the command builder to allow for command 865 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 866 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 867 * 868 * @param string the string to use as input 869 * @return the command builder to allow for method chaining. Method 870 * chaining is used here to create command chains. Adding a command 871 * to the chain usually means that the previous command <i>pipes</i> 872 * its output to the added command (the pipe symbol in unix) 873 */ 874 public static Unix4jCommandBuilder fromString(String string) { 875 return builder().fromString(string); 876 } 877 /** 878 * Uses the given strings as input for the next command. Each string 879 usually represents a single line of the input; however, if any of 880 the strings contains line ending codes (UNIX or DOS independent from 881 the host operating system), it is split into multiple lines. 882 * <p> 883 * Note that the method returns the command builder to allow for command 884 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 885 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 886 * 887 * @param strings the input lines 888 * @return the command builder to allow for method chaining. Method 889 * chaining is used here to create command chains. Adding a command 890 * to the chain usually means that the previous command <i>pipes</i> 891 * its output to the added command (the pipe symbol in unix) 892 */ 893 public static Unix4jCommandBuilder fromStrings(String... strings) { 894 return builder().fromStrings(strings); 895 } 896 /** 897 * Uses the strings in the specified {@code input} iterable as input 898 lines for the next command. Each string usually represents a single 899 line of the input; however, if any of the strings contains line 900 ending codes (UNIX or DOS independent from the host operating 901 system), it is split into multiple lines. 902 * <p> 903 * Note that the method returns the command builder to allow for command 904 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 905 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 906 * 907 * @param lines collection with input lines 908 * @return the command builder to allow for method chaining. Method 909 * chaining is used here to create command chains. Adding a command 910 * to the chain usually means that the previous command <i>pipes</i> 911 * its output to the added command (the pipe symbol in unix) 912 */ 913 public static Unix4jCommandBuilder from(Iterable<? extends String> lines) { 914 return builder().from(lines); 915 } 916 /** 917 * Uses the strings returned by the specified iterator as input 918 lines for the next command. Each string usually represents a single 919 line of the input; however, if any of the strings contains line 920 ending codes (UNIX or DOS independent from the host operating 921 system), it is split into multiple lines. 922 * <p> 923 * Note that the method returns the command builder to allow for command 924 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 925 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 926 * 927 * @param iterator iterator returning input lines 928 * @return the command builder to allow for method chaining. Method 929 * chaining is used here to create command chains. Adding a command 930 * to the chain usually means that the previous command <i>pipes</i> 931 * its output to the added command (the pipe symbol in unix) 932 */ 933 public static Unix4jCommandBuilder from(java.util.Iterator<? extends String> iterator) { 934 return builder().from(iterator); 935 } 936 /** 937 * Uses the strings returned by the specified stream as input 938 lines for the next command. Each string usually represents a single 939 line of the input; however, if any of the strings contains line 940 ending codes (UNIX or DOS independent from the host operating 941 system), it is split into multiple lines. 942 * <p> 943 * Note that the method returns the command builder to allow for command 944 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 945 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 946 * 947 * @param stream stream of input lines 948 * @return the command builder to allow for method chaining. Method 949 * chaining is used here to create command chains. Adding a command 950 * to the chain usually means that the previous command <i>pipes</i> 951 * its output to the added command (the pipe symbol in unix) 952 */ 953 public static Unix4jCommandBuilder from(java.util.stream.Stream<? extends String> stream) { 954 return builder().from(stream); 955 } 956 /** 957 * Redirects the contents of the given file into the next command. This 958 is essentially equivalent to the following syntax in a unix command 959 shell: {@code path > ...} 960 * <p> 961 * Note that the method returns the command builder to allow for command 962 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 963 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 964 * 965 * @param path the file to use as input; wildcards * and ? are supported; relative 966 paths are resolved on the basis of the current working directory. 967 * @return the command builder to allow for method chaining. Method 968 * chaining is used here to create command chains. Adding a command 969 * to the chain usually means that the previous command <i>pipes</i> 970 * its output to the added command (the pipe symbol in unix) 971 */ 972 public static Unix4jCommandBuilder fromFile(String path) { 973 return builder().fromFile(path); 974 } 975 /** 976 * Redirects the contents of the given file into the next command. This 977 is essentially equivalent to the following syntax in a unix command 978 shell: {@code file > ...} 979 * <p> 980 * Note that the method returns the command builder to allow for command 981 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 982 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 983 * 984 * @param file the file to use as input; relative paths are not resolved (use the 985 string path argument to enable relative path resolving based on the 986 current working directory). 987 * @return the command builder to allow for method chaining. Method 988 * chaining is used here to create command chains. Adding a command 989 * to the chain usually means that the previous command <i>pipes</i> 990 * its output to the added command (the pipe symbol in unix) 991 */ 992 public static Unix4jCommandBuilder fromFile(java.io.File file) { 993 return builder().fromFile(file); 994 } 995 /** 996 * Reads from the given resource relative to the classpath and 997 redirects the contents into the next command. The resource is 998 usually a file or URL on the classpath. The resource is read using 999 {@link Class#getResourceAsStream(String)}. 1000 * <p> 1001 * Note that the method returns the command builder to allow for command 1002 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1003 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1004 * 1005 * @param resource a path to the file to redirect to the next command. The resource needs 1006 to be on the classpath. If the file is in the root directory, the 1007 filename should be prefixed with a forward slash. e.g.: 1008 {@code "/test-file.txt"}. 1009 <p> 1010 If the file is in a package, then the package should be specified 1011 prefixed with a forward slash, and with each dot "." replaced with a 1012 forward slash. e.g.: 1013 {@code "/org/company/mypackage/test-file.txt"}. 1014 A {@code base} class operand can be provided for relative paths; see 1015 {@link java.lang.Class#getResourceAsStream(String)} for details about 1016 resource loading. 1017 * @return the command builder to allow for method chaining. Method 1018 * chaining is used here to create command chains. Adding a command 1019 * to the chain usually means that the previous command <i>pipes</i> 1020 * its output to the added command (the pipe symbol in unix) 1021 */ 1022 public static Unix4jCommandBuilder fromResource(String resource) { 1023 return builder().fromResource(resource); 1024 } 1025 /** 1026 * Reads from the given resource relative to the classpath and 1027 redirects the contents into the next command. The resource is 1028 usually a file or URL on the classpath. The resource is read using 1029 {@link Class#getResourceAsStream(String)}. 1030 * <p> 1031 * Note that the method returns the command builder to allow for command 1032 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1033 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1034 * 1035 * @param base base class for subsequent {@code resource} operand if relative paths are used. 1036 * @param resource a path to the file to redirect to the next command. The resource needs 1037 to be on the classpath. If the file is in the root directory, the 1038 filename should be prefixed with a forward slash. e.g.: 1039 {@code "/test-file.txt"}. 1040 <p> 1041 If the file is in a package, then the package should be specified 1042 prefixed with a forward slash, and with each dot "." replaced with a 1043 forward slash. e.g.: 1044 {@code "/org/company/mypackage/test-file.txt"}. 1045 A {@code base} class operand can be provided for relative paths; see 1046 {@link java.lang.Class#getResourceAsStream(String)} for details about 1047 resource loading. 1048 * @return the command builder to allow for method chaining. Method 1049 * chaining is used here to create command chains. Adding a command 1050 * to the chain usually means that the previous command <i>pipes</i> 1051 * its output to the added command (the pipe symbol in unix) 1052 */ 1053 public static Unix4jCommandBuilder fromResource(Class<?> base, String resource) { 1054 return builder().fromResource(base, resource); 1055 } 1056 /** 1057 * Reads from the given input stream and redirects the contents into 1058 the next command. 1059 * <p> 1060 * Note that the method returns the command builder to allow for command 1061 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1062 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1063 * 1064 * @param in the input stream to read from 1065 * @return the command builder to allow for method chaining. Method 1066 * chaining is used here to create command chains. Adding a command 1067 * to the chain usually means that the previous command <i>pipes</i> 1068 * its output to the added command (the pipe symbol in unix) 1069 */ 1070 public static Unix4jCommandBuilder from(java.io.InputStream in) { 1071 return builder().from(in); 1072 } 1073 /** 1074 * Uses the given reader and redirects the read input into the next 1075 command. 1076 * <p> 1077 * Note that the method returns the command builder to allow for command 1078 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1079 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1080 * 1081 * @param reader the reader used to read the input 1082 * @return the command builder to allow for method chaining. Method 1083 * chaining is used here to create command chains. Adding a command 1084 * to the chain usually means that the previous command <i>pipes</i> 1085 * its output to the added command (the pipe symbol in unix) 1086 */ 1087 public static Unix4jCommandBuilder from(java.io.Reader reader) { 1088 return builder().from(reader); 1089 } 1090 /** 1091 * Reads from the given URL and redirects the contents into the next 1092 command. 1093 * <p> 1094 * Note that the method returns the command builder to allow for command 1095 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1096 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1097 * 1098 * @param url the URL to read from 1099 * @return the command builder to allow for method chaining. Method 1100 * chaining is used here to create command chains. Adding a command 1101 * to the chain usually means that the previous command <i>pipes</i> 1102 * its output to the added command (the pipe symbol in unix) 1103 */ 1104 public static Unix4jCommandBuilder from(java.net.URL url) { 1105 return builder().from(url); 1106 } 1107 /** 1108 * Reads from the given input object and redirects the contents into 1109 the next command. 1110 * <p> 1111 * Note that the method returns the command builder to allow for command 1112 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1113 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1114 * 1115 * @param input the input object to read from 1116 * @return the command builder to allow for method chaining. Method 1117 * chaining is used here to create command chains. Adding a command 1118 * to the chain usually means that the previous command <i>pipes</i> 1119 * its output to the added command (the pipe symbol in unix) 1120 */ 1121 public static Unix4jCommandBuilder from(org.unix4j.io.Input input) { 1122 return builder().from(input); 1123 } 1124 /** 1125 * Filters the lines from the specified input files and writes the 1126 matching lines to the standard output. Every line is matched against 1127 the given {@code regexp} string using case-sensitive comparison. 1128 Line endings are not relevant for the comparison. 1129 * <p> 1130 * Note that the method returns the command builder to allow for command 1131 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1132 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1133 * 1134 * @param regexp Lines will be printed which match the given regular expression. The 1135 {@code regexp} string is surrounded with ".*" on both sides unless 1136 the {@code --wholeLine} option is specified. If the 1137 {@code --fixedStrings} option is used, plain string comparison is 1138 used instead of regular expression matching. 1139 * @param files The input files to be searched for the pattern; relative paths are 1140 not resolved (use the string paths argument to enable relative path 1141 resolving based on the current working directory). 1142 * @return the command builder to allow for method chaining. Method 1143 * chaining is used here to create command chains. Adding a command 1144 * to the chain usually means that the previous command <i>pipes</i> 1145 * its output to the added command (the pipe symbol in unix) 1146 */ 1147 public static Unix4jCommandBuilder grep(String regexp, java.io.File... files) { 1148 return builder().grep(regexp, files); 1149 } 1150 /** 1151 * Filters the lines from the specified inputs and writes the 1152 matching lines to the standard output. Every line is matched against 1153 the given {@code regexp} string using case-sensitive comparison. 1154 Line endings are not relevant for the comparison. 1155 * <p> 1156 * Note that the method returns the command builder to allow for command 1157 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1158 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1159 * 1160 * @param regexp Lines will be printed which match the given regular expression. The 1161 {@code regexp} string is surrounded with ".*" on both sides unless 1162 the {@code --wholeLine} option is specified. If the 1163 {@code --fixedStrings} option is used, plain string comparison is 1164 used instead of regular expression matching. 1165 * @param inputs The inputs to be searched for the pattern. 1166 * @return the command builder to allow for method chaining. Method 1167 * chaining is used here to create command chains. Adding a command 1168 * to the chain usually means that the previous command <i>pipes</i> 1169 * its output to the added command (the pipe symbol in unix) 1170 */ 1171 public static Unix4jCommandBuilder grep(String regexp, org.unix4j.io.Input... inputs) { 1172 return builder().grep(regexp, inputs); 1173 } 1174 /** 1175 * Filters the lines from the specified input files and writes the 1176 matching lines to the standard output. Every line is matched against 1177 the given regular expression {@code pattern} using case-sensitive 1178 comparison. Line endings are not relevant for the comparison. 1179 * <p> 1180 * Note that the method returns the command builder to allow for command 1181 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1182 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1183 * 1184 * @param pattern Lines will be printed which match the given pattern. 1185 * @param files The input files to be searched for the pattern; relative paths are 1186 not resolved (use the string paths argument to enable relative path 1187 resolving based on the current working directory). 1188 * @return the command builder to allow for method chaining. Method 1189 * chaining is used here to create command chains. Adding a command 1190 * to the chain usually means that the previous command <i>pipes</i> 1191 * its output to the added command (the pipe symbol in unix) 1192 */ 1193 public static Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, java.io.File... files) { 1194 return builder().grep(pattern, files); 1195 } 1196 /** 1197 * Filters the lines from the specified input files and writes the 1198 matching lines to the standard output. Every line is matched against 1199 the given regular expression {@code pattern} using case-sensitive 1200 comparison. Line endings are not relevant for the comparison. 1201 * <p> 1202 * Note that the method returns the command builder to allow for command 1203 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1204 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1205 * 1206 * @param pattern Lines will be printed which match the given pattern. 1207 * @param paths Path names of the input files to be searched for the pattern; 1208 wildcards * and ? are supported; relative paths are resolved on the 1209 basis of the current working directory. 1210 * @return the command builder to allow for method chaining. Method 1211 * chaining is used here to create command chains. Adding a command 1212 * to the chain usually means that the previous command <i>pipes</i> 1213 * its output to the added command (the pipe symbol in unix) 1214 */ 1215 public static Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, String... paths) { 1216 return builder().grep(pattern, paths); 1217 } 1218 /** 1219 * Filters the lines from the specified inputs and writes the 1220 matching lines to the standard output. Every line is matched against 1221 the given regular expression {@code pattern} using case-sensitive 1222 comparison. Line endings are not relevant for the comparison. 1223 * <p> 1224 * Note that the method returns the command builder to allow for command 1225 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1226 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1227 * 1228 * @param pattern Lines will be printed which match the given pattern. 1229 * @param inputs The inputs to be searched for the pattern. 1230 * @return the command builder to allow for method chaining. Method 1231 * chaining is used here to create command chains. Adding a command 1232 * to the chain usually means that the previous command <i>pipes</i> 1233 * its output to the added command (the pipe symbol in unix) 1234 */ 1235 public static Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, org.unix4j.io.Input... inputs) { 1236 return builder().grep(pattern, inputs); 1237 } 1238 /** 1239 * Filters the input lines from the specified input files and writes 1240 the matching lines to the standard output. Every line is matched 1241 against the given {@code regexp} string; the exact comparison rules 1242 are defined by the specified matching {@code options}. 1243 * <p> 1244 * Note that the method returns the command builder to allow for command 1245 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1246 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1247 * 1248 * @param options The options defining the types of patterns and command behavior. 1249 * @param regexp Lines will be printed which match the given regular expression. The 1250 {@code regexp} string is surrounded with ".*" on both sides unless 1251 the {@code --wholeLine} option is specified. If the 1252 {@code --fixedStrings} option is used, plain string comparison is 1253 used instead of regular expression matching. 1254 * @param files The input files to be searched for the pattern; relative paths are 1255 not resolved (use the string paths argument to enable relative path 1256 resolving based on the current working directory). 1257 * @return the command builder to allow for method chaining. Method 1258 * chaining is used here to create command chains. Adding a command 1259 * to the chain usually means that the previous command <i>pipes</i> 1260 * its output to the added command (the pipe symbol in unix) 1261 */ 1262 public static Unix4jCommandBuilder grep(GrepOptions options, String regexp, java.io.File... files) { 1263 return builder().grep(options, regexp, files); 1264 } 1265 /** 1266 * Filters the input lines from the specified input files and writes 1267 the matching lines to the standard output. Every line is matched 1268 against the given {@code regexp} string; the exact comparison rules 1269 are defined by the specified matching {@code options}. 1270 * <p> 1271 * Note that the method returns the command builder to allow for command 1272 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1273 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1274 * 1275 * @param options The options defining the types of patterns and command behavior. 1276 * @param regexp Lines will be printed which match the given regular expression. The 1277 {@code regexp} string is surrounded with ".*" on both sides unless 1278 the {@code --wholeLine} option is specified. If the 1279 {@code --fixedStrings} option is used, plain string comparison is 1280 used instead of regular expression matching. 1281 * @param paths Path names of the input files to be searched for the pattern; 1282 wildcards * and ? are supported; relative paths are resolved on the 1283 basis of the current working directory. 1284 * @return the command builder to allow for method chaining. Method 1285 * chaining is used here to create command chains. Adding a command 1286 * to the chain usually means that the previous command <i>pipes</i> 1287 * its output to the added command (the pipe symbol in unix) 1288 */ 1289 public static Unix4jCommandBuilder grep(GrepOptions options, String regexp, String... paths) { 1290 return builder().grep(options, regexp, paths); 1291 } 1292 /** 1293 * Filters the input lines from the specified inputs and writes 1294 the matching lines to the standard output. Every line is matched 1295 against the given {@code regexp} string; the exact comparison rules 1296 are defined by the specified matching {@code options}. 1297 * <p> 1298 * Note that the method returns the command builder to allow for command 1299 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1300 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1301 * 1302 * @param options The options defining the types of patterns and command behavior. 1303 * @param regexp Lines will be printed which match the given regular expression. The 1304 {@code regexp} string is surrounded with ".*" on both sides unless 1305 the {@code --wholeLine} option is specified. If the 1306 {@code --fixedStrings} option is used, plain string comparison is 1307 used instead of regular expression matching. 1308 * @param inputs The inputs to be searched for the pattern. 1309 * @return the command builder to allow for method chaining. Method 1310 * chaining is used here to create command chains. Adding a command 1311 * to the chain usually means that the previous command <i>pipes</i> 1312 * its output to the added command (the pipe symbol in unix) 1313 */ 1314 public static Unix4jCommandBuilder grep(GrepOptions options, String regexp, org.unix4j.io.Input... inputs) { 1315 return builder().grep(options, regexp, inputs); 1316 } 1317 /** 1318 * Filters the input lines from the specified input files and writes 1319 the matching lines to the standard output. Every line is matched 1320 against the given regular expression {@code pattern}; the exact 1321 comparison rules are defined by the specified matching 1322 {@code options}. 1323 * <p> 1324 * Note that the method returns the command builder to allow for command 1325 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1326 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1327 * 1328 * @param options The options defining the types of patterns and command behavior. 1329 * @param pattern Lines will be printed which match the given pattern. 1330 * @param files The input files to be searched for the pattern; relative paths are 1331 not resolved (use the string paths argument to enable relative path 1332 resolving based on the current working directory). 1333 * @return the command builder to allow for method chaining. Method 1334 * chaining is used here to create command chains. Adding a command 1335 * to the chain usually means that the previous command <i>pipes</i> 1336 * its output to the added command (the pipe symbol in unix) 1337 */ 1338 public static Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, java.io.File... files) { 1339 return builder().grep(options, pattern, files); 1340 } 1341 /** 1342 * Filters the input lines from the specified input files and writes 1343 the matching lines to the standard output. Every line is matched 1344 against the given regular expression {@code pattern}; the exact 1345 comparison rules are defined by the specified matching 1346 {@code options}. 1347 * <p> 1348 * Note that the method returns the command builder to allow for command 1349 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1350 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1351 * 1352 * @param options The options defining the types of patterns and command behavior. 1353 * @param pattern Lines will be printed which match the given pattern. 1354 * @param paths Path names of the input files to be searched for the pattern; 1355 wildcards * and ? are supported; relative paths are resolved on the 1356 basis of the current working directory. 1357 * @return the command builder to allow for method chaining. Method 1358 * chaining is used here to create command chains. Adding a command 1359 * to the chain usually means that the previous command <i>pipes</i> 1360 * its output to the added command (the pipe symbol in unix) 1361 */ 1362 public static Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, String... paths) { 1363 return builder().grep(options, pattern, paths); 1364 } 1365 /** 1366 * Filters the input lines from the specified inputs and writes 1367 the matching lines to the standard output. Every line is matched 1368 against the given regular expression {@code pattern}; the exact 1369 comparison rules are defined by the specified matching 1370 {@code options}. 1371 * <p> 1372 * Note that the method returns the command builder to allow for command 1373 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1374 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1375 * 1376 * @param options The options defining the types of patterns and command behavior. 1377 * @param pattern Lines will be printed which match the given pattern. 1378 * @param inputs The inputs to be searched for the pattern. 1379 * @return the command builder to allow for method chaining. Method 1380 * chaining is used here to create command chains. Adding a command 1381 * to the chain usually means that the previous command <i>pipes</i> 1382 * its output to the added command (the pipe symbol in unix) 1383 */ 1384 public static Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, org.unix4j.io.Input... inputs) { 1385 return builder().grep(options, pattern, inputs); 1386 } 1387 /** 1388 * Reads the first 10 lines from each of the specified files and writes 1389 them to the standard output. If more than a single file is 1390 specified, each file is preceded by a header consisting of the 1391 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1392 of the file. 1393 * <p> 1394 * Note that the method returns the command builder to allow for command 1395 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1396 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1397 * 1398 * @param files The input files to be filtered; relative paths are not resolved (use 1399 the string paths argument to enable relative path resolving based on 1400 the current working directory). 1401 * @return the command 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 added command (the pipe symbol in unix) 1405 */ 1406 public static Unix4jCommandBuilder head(java.io.File... files) { 1407 return builder().head(files); 1408 } 1409 /** 1410 * Reads the first 10 lines from each of the specified inputs and writes 1411 them to the standard output. If more than a input is 1412 specified, each file is preceded by a header consisting of the 1413 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 1414 string representation. 1415 * <p> 1416 * Note that the method returns the command builder to allow for command 1417 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1418 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1419 * 1420 * @param inputs The inputs to be filtered. 1421 * @return the command builder to allow for method chaining. Method 1422 * chaining is used here to create command chains. Adding a command 1423 * to the chain usually means that the previous command <i>pipes</i> 1424 * its output to the added command (the pipe symbol in unix) 1425 */ 1426 public static Unix4jCommandBuilder head(org.unix4j.io.Input... inputs) { 1427 return builder().head(inputs); 1428 } 1429 /** 1430 * Reads the first {@code count} lines from each of the specified files 1431 and writes them to the standard output. If more than a single file 1432 is specified, each file is preceded by a header consisting of the 1433 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1434 of the file. 1435 * <p> 1436 * Note that the method returns the command builder to allow for command 1437 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1438 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1439 * 1440 * @param count The first {@code count} lines of each input file are 1441 copied to standard output, starting from 1 (characters instead of 1442 lines if the {@code -c} option is specified). Must be a non-negative 1443 integer or an exception is thrown. If {@code count} is greater than 1444 the number number of lines (characters) in the input, the 1445 application will not error and send the whole file to the output. 1446 * @param files The input files to be filtered; relative paths are not resolved (use 1447 the string paths argument to enable relative path resolving based on 1448 the current working directory). 1449 * @return the command builder to allow for method chaining. Method 1450 * chaining is used here to create command chains. Adding a command 1451 * to the chain usually means that the previous command <i>pipes</i> 1452 * its output to the added command (the pipe symbol in unix) 1453 */ 1454 public static Unix4jCommandBuilder head(long count, java.io.File... files) { 1455 return builder().head(count, files); 1456 } 1457 /** 1458 * Reads the first {@code count} lines from each of the specified files 1459 and writes them to the standard output. If more than a single file 1460 is specified, each file is preceded by a header consisting of the 1461 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1462 of the file. 1463 * <p> 1464 * Note that the method returns the command builder to allow for command 1465 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1466 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1467 * 1468 * @param count The first {@code count} lines of each input file are 1469 copied to standard output, starting from 1 (characters instead of 1470 lines if the {@code -c} option is specified). Must be a non-negative 1471 integer or an exception is thrown. If {@code count} is greater than 1472 the number number of lines (characters) in the input, the 1473 application will not error and send the whole file to the output. 1474 * @param paths Path names of the input files to be filtered; wildcards * and ? are 1475 supported; relative paths are resolved on the basis of the current 1476 working directory. 1477 * @return the command builder to allow for method chaining. Method 1478 * chaining is used here to create command chains. Adding a command 1479 * to the chain usually means that the previous command <i>pipes</i> 1480 * its output to the added command (the pipe symbol in unix) 1481 */ 1482 public static Unix4jCommandBuilder head(long count, String... paths) { 1483 return builder().head(count, paths); 1484 } 1485 /** 1486 * Reads the first {@code count} lines from each of the specified inputs 1487 and writes them to the standard output. If more than a single input 1488 is specified, each file is preceded by a header consisting of the 1489 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 1490 string representation. 1491 * <p> 1492 * Note that the method returns the command builder to allow for command 1493 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1494 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1495 * 1496 * @param count The first {@code count} lines of each input file are 1497 copied to standard output, starting from 1 (characters instead of 1498 lines if the {@code -c} option is specified). Must be a non-negative 1499 integer or an exception is thrown. If {@code count} is greater than 1500 the number number of lines (characters) in the input, the 1501 application will not error and send the whole file to the output. 1502 * @param inputs The inputs to be filtered. 1503 * @return the command builder to allow for method chaining. Method 1504 * chaining is used here to create command chains. Adding a command 1505 * to the chain usually means that the previous command <i>pipes</i> 1506 * its output to the added command (the pipe symbol in unix) 1507 */ 1508 public static Unix4jCommandBuilder head(long count, org.unix4j.io.Input... inputs) { 1509 return builder().head(count, inputs); 1510 } 1511 /** 1512 * Reads the first {@code count} lines or characters from each of the 1513 specified files and writes them to the standard output. If more than 1514 a single file is specified and the {@code -q} option is not 1515 specified, each file is preceded by a header consisting of the 1516 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1517 of the file. 1518 * <p> 1519 * Note that the method returns the command builder to allow for command 1520 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1521 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1522 * 1523 * @param options Options for the head command. 1524 * @param count The first {@code count} lines of each input file are 1525 copied to standard output, starting from 1 (characters instead of 1526 lines if the {@code -c} option is specified). Must be a non-negative 1527 integer or an exception is thrown. If {@code count} is greater than 1528 the number number of lines (characters) in the input, the 1529 application will not error and send the whole file to the output. 1530 * @param files The input files to be filtered; relative paths are not resolved (use 1531 the string paths argument to enable relative path resolving based on 1532 the current working directory). 1533 * @return the command builder to allow for method chaining. Method 1534 * chaining is used here to create command chains. Adding a command 1535 * to the chain usually means that the previous command <i>pipes</i> 1536 * its output to the added command (the pipe symbol in unix) 1537 */ 1538 public static Unix4jCommandBuilder head(HeadOptions options, long count, java.io.File... files) { 1539 return builder().head(options, count, files); 1540 } 1541 /** 1542 * Reads the first {@code count} lines or characters from each of the 1543 specified files and writes them to the standard output. If more than 1544 a single file is specified and the {@code -q} option is not 1545 specified, each file is preceded by a header consisting of the 1546 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1547 of the file. 1548 * <p> 1549 * Note that the method returns the command builder to allow for command 1550 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1551 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1552 * 1553 * @param options Options for the head command. 1554 * @param count The first {@code count} lines of each input file are 1555 copied to standard output, starting from 1 (characters instead of 1556 lines if the {@code -c} option is specified). Must be a non-negative 1557 integer or an exception is thrown. If {@code count} is greater than 1558 the number number of lines (characters) in the input, the 1559 application will not error and send the whole file to the output. 1560 * @param paths Path names of the input files to be filtered; wildcards * and ? are 1561 supported; relative paths are resolved on the basis of the current 1562 working directory. 1563 * @return the command builder to allow for method chaining. Method 1564 * chaining is used here to create command chains. Adding a command 1565 * to the chain usually means that the previous command <i>pipes</i> 1566 * its output to the added command (the pipe symbol in unix) 1567 */ 1568 public static Unix4jCommandBuilder head(HeadOptions options, long count, String... paths) { 1569 return builder().head(options, count, paths); 1570 } 1571 /** 1572 * Reads the first {@code count} lines or characters from each of the 1573 specified inputs and writes them to the standard output. If more than 1574 a single input is specified and the {@code -q} option is not 1575 specified, each file is preceded by a header consisting of the 1576 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 1577 string representation. 1578 * <p> 1579 * Note that the method returns the command builder to allow for command 1580 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1581 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1582 * 1583 * @param options Options for the head command. 1584 * @param count The first {@code count} lines of each input file are 1585 copied to standard output, starting from 1 (characters instead of 1586 lines if the {@code -c} option is specified). Must be a non-negative 1587 integer or an exception is thrown. If {@code count} is greater than 1588 the number number of lines (characters) in the input, the 1589 application will not error and send the whole file to the output. 1590 * @param inputs The inputs to be filtered. 1591 * @return the command builder to allow for method chaining. Method 1592 * chaining is used here to create command chains. Adding a command 1593 * to the chain usually means that the previous command <i>pipes</i> 1594 * its output to the added command (the pipe symbol in unix) 1595 */ 1596 public static Unix4jCommandBuilder head(HeadOptions options, long count, org.unix4j.io.Input... inputs) { 1597 return builder().head(options, count, inputs); 1598 } 1599 /** 1600 * Lists all files and directories in the user's current working 1601 directory and writes them to the output. 1602 * <p> 1603 * Note that the method returns the command builder to allow for command 1604 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1605 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1606 * 1607 * @return the command builder to allow for method chaining. Method 1608 * chaining is used here to create command chains. Adding a command 1609 * to the chain usually means that the previous command <i>pipes</i> 1610 * its output to the added command (the pipe symbol in unix) 1611 */ 1612 public static Unix4jCommandBuilder ls() { 1613 return builder().ls(); 1614 } 1615 /** 1616 * Prints the name of the specified files and lists all files contained 1617 in directories for every directory in those files. 1618 <p> 1619 Options can be specified by acronym (with a leading dash "-") or by 1620 long name (with two leading dashes "--"). Operands other than the 1621 default "--paths" operand have to be prefixed with the operand 1622 name. 1623 * <p> 1624 * Note that the method returns the command builder to allow for command 1625 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1626 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1627 * 1628 * @param args String arguments defining the options and operands for the command. 1629 Options can be specified by acronym (with a leading dash "-") or by 1630 long name (with two leading dashes "--"). Operands other than the 1631 default "--paths" operand have to be prefixed with the operand 1632 name (e.g. "--count" for a subsequent count operand value). 1633 * @return the command builder to allow for method chaining. Method 1634 * chaining is used here to create command chains. Adding a command 1635 * to the chain usually means that the previous command <i>pipes</i> 1636 * its output to the added command (the pipe symbol in unix) 1637 */ 1638 public static Unix4jCommandBuilder ls(String... args) { 1639 return builder().ls(args); 1640 } 1641 /** 1642 * Prints the name of the given files and lists all files contained in 1643 directories for every directory in {@code files}. 1644 * <p> 1645 * Note that the method returns the command builder to allow for command 1646 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1647 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1648 * 1649 * @param files The files or directories used as starting point for the listing; 1650 relative paths are not resolved (use the string path argument to 1651 enable relative path resolving based on the current working 1652 directory). 1653 * @return the command builder to allow for method chaining. Method 1654 * chaining is used here to create command chains. Adding a command 1655 * to the chain usually means that the previous command <i>pipes</i> 1656 * its output to the added command (the pipe symbol in unix) 1657 */ 1658 public static Unix4jCommandBuilder ls(java.io.File... files) { 1659 return builder().ls(files); 1660 } 1661 /** 1662 * Lists all files and directories in the user's current working 1663 directory and writes them to the output using the given options 1664 specifying the details of the output format. 1665 * <p> 1666 * Note that the method returns the command builder to allow for command 1667 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1668 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1669 * 1670 * @param options The options defining the output format. 1671 * @return the command 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 added command (the pipe symbol in unix) 1675 */ 1676 public static Unix4jCommandBuilder ls(LsOptions options) { 1677 return builder().ls(options); 1678 } 1679 /** 1680 * Prints the name of the given files and lists all files contained in 1681 directories for every directory in {@code files}. The given options 1682 define the details of the output format. 1683 * <p> 1684 * Note that the method returns the command builder to allow for command 1685 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1686 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1687 * 1688 * @param options The options defining the output format. 1689 * @param files The files or directories used as starting point for the listing; 1690 relative paths are not resolved (use the string path argument to 1691 enable relative path resolving based on the current working 1692 directory). 1693 * @return the command builder to allow for method chaining. Method 1694 * chaining is used here to create command chains. Adding a command 1695 * to the chain usually means that the previous command <i>pipes</i> 1696 * its output to the added command (the pipe symbol in unix) 1697 */ 1698 public static Unix4jCommandBuilder ls(LsOptions options, java.io.File... files) { 1699 return builder().ls(options, files); 1700 } 1701 /** 1702 * Prints the name of the given files and lists all files contained in 1703 directories for every directory in {@code files}. The given options 1704 define the details of the output format. 1705 * <p> 1706 * Note that the method returns the command builder to allow for command 1707 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1708 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1709 * 1710 * @param options The options defining the output format. 1711 * @param paths The files or directories used as starting point for the listing; 1712 wildcards * and ? are supported; relative paths are resolved on the 1713 basis of the current working directory. 1714 * @return the command 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 added command (the pipe symbol in unix) 1718 */ 1719 public static Unix4jCommandBuilder ls(LsOptions options, String... paths) { 1720 return builder().ls(options, paths); 1721 } 1722 /** 1723 * Executes the sed script specified by the given arguments and writes 1724 the result to the standard output. 1725 <p> 1726 Options can be specified by acronym (with a leading dash "-") or by 1727 long name (with two leading dashes "--"). Operands other than the 1728 default "--script" operand have to be prefixed with the operand name. 1729 * <p> 1730 * Note that the method returns the command builder to allow for command 1731 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1732 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1733 * 1734 * @param args String arguments defining the options and operands for the command. 1735 Options can be specified by acronym (with a leading dash "-") or by 1736 long name (with two leading dashes "--"). Operands other than the 1737 default "--script" operand have to be prefixed with the operand name 1738 (e.g. "--occurrence" for subsequent occurrence indices). 1739 * @return the command builder to allow for method chaining. Method 1740 * chaining is used here to create command chains. Adding a command 1741 * to the chain usually means that the previous command <i>pipes</i> 1742 * its output to the added command (the pipe symbol in unix) 1743 */ 1744 public static Unix4jCommandBuilder sed(String... args) { 1745 return builder().sed(args); 1746 } 1747 /** 1748 * Executes the given sed script, such as "s/original/replacement/g". 1749 * <p> 1750 * Note that the method returns the command builder to allow for command 1751 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1752 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1753 * 1754 * @param script Sed script as one string, such as "s/original/replacement/g". 1755 * @return the command builder to allow for method chaining. Method 1756 * chaining is used here to create command chains. Adding a command 1757 * to the chain usually means that the previous command <i>pipes</i> 1758 * its output to the added command (the pipe symbol in unix) 1759 */ 1760 public static Unix4jCommandBuilder sed(String script) { 1761 return builder().sed(script); 1762 } 1763 /** 1764 * Substitutes the replacement string for instances of the regexp in 1765 the matched line. 1766 <p> 1767 The characters "$0" appearing in the replacement are replaced 1768 by the line matching the regexp. The characters "$n", where n is a 1769 digit other than zero, are replaced by the text matched by the 1770 corresponding backreference expression (aka group). The special 1771 meaning of "$n" in this context can be suppressed by preceding it 1772 by a backslash. 1773<p> 1774 A line can be split by substituting a newline ('\n') into it. 1775 <p> 1776 A substitution is considered to have been performed even if the 1777 replacement string is identical to the string that it replaces. 1778 * <p> 1779 * Note that the method returns the command builder to allow for command 1780 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1781 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1782 * 1783 * @param regexp Regular expression matched against a line. 1784 * @param replacement Replacement string for substitute command. The characters "$0" 1785 appearing in the replacement are replaced by the line matching 1786 the regexp. The characters "$n", where n is a digit other than zero, 1787 are replaced by the text matched by the corresponding backreference 1788 expression (aka group). The special meaning of "$n" in this context 1789 can be suppressed by preceding it by a backslash. 1790 * @return the command builder to allow for method chaining. Method 1791 * chaining is used here to create command chains. Adding a command 1792 * to the chain usually means that the previous command <i>pipes</i> 1793 * its output to the added command (the pipe symbol in unix) 1794 */ 1795 public static Unix4jCommandBuilder sed(String regexp, String replacement) { 1796 return builder().sed(regexp, replacement); 1797 } 1798 /** 1799 * Substitutes the replacement string for instances of the regexp in 1800 the matched line. Only the given occurrences of the regexp found 1801 within the matched string are substituted. 1802<p> 1803 The characters "$0" appearing in the replacement are replaced 1804 by the line matching the regexp. The characters "$n", where n is a 1805 digit other than zero, are replaced by the text matched by the 1806 corresponding backreference expression (aka group). The special 1807 meaning of "$n" in this context can be suppressed by preceding it 1808 by a backslash. 1809<p> 1810 A line can be split by substituting a newline ('\n') into it. 1811 <p> 1812 A substitution is considered to have been performed even if the 1813 replacement string is identical to the string that it replaces. 1814 * <p> 1815 * Note that the method returns the command builder to allow for command 1816 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1817 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1818 * 1819 * @param regexp Regular expression matched against a line. 1820 * @param replacement Replacement string for substitute command. The characters "$0" 1821 appearing in the replacement are replaced by the line matching 1822 the regexp. The characters "$n", where n is a digit other than zero, 1823 are replaced by the text matched by the corresponding backreference 1824 expression (aka group). The special meaning of "$n" in this context 1825 can be suppressed by preceding it by a backslash. 1826 * @param occurrence Substitute for the given occurrences only of the regexp found within 1827 the matched string; the occurrence indices are one-based. If empty 1828 or omitted, all occurrences are substituted. 1829 <p> 1830 (This operand only applies to the substitute command and is ignored 1831 by all other commands). 1832 * @return the command builder to allow for method chaining. Method 1833 * chaining is used here to create command chains. Adding a command 1834 * to the chain usually means that the previous command <i>pipes</i> 1835 * its output to the added command (the pipe symbol in unix) 1836 */ 1837 public static Unix4jCommandBuilder sed(String regexp, String replacement, int... occurrence) { 1838 return builder().sed(regexp, replacement, occurrence); 1839 } 1840 /** 1841 * Executes the sed command specified by the given options or executes 1842 the print command p if no command option has been declared. 1843 * <p> 1844 * Note that the method returns the command builder to allow for command 1845 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1846 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1847 * 1848 * @param options Sed options and commands 1849 * @param regexp Regular expression matched against a line. 1850 * @return the command builder to allow for method chaining. Method 1851 * chaining is used here to create command chains. Adding a command 1852 * to the chain usually means that the previous command <i>pipes</i> 1853 * its output to the added command (the pipe symbol in unix) 1854 */ 1855 public static Unix4jCommandBuilder sed(SedOptions options, String regexp) { 1856 return builder().sed(options, regexp); 1857 } 1858 /** 1859 * Executes the sed command specified by the given options or executes 1860 the substitute command s if no command option has been declared. 1861 * <p> 1862 * Note that the method returns the command builder to allow for command 1863 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1864 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1865 * 1866 * @param options Sed options and commands 1867 * @param string1 Regular expression matched against a line for all commands except 1868 for command y where string1 contains the source characters for the 1869 translation. 1870 * @param string2 Replacement string for substitute command s; appended, inserted or 1871 changed text for a, i and c command; destination characters for 1872 translate command y; ignored by all other commands. 1873 <p> 1874 If string2 is a replacement string for the substitute command: the 1875 characters "$0" appearing in the replacement are replaced 1876 by the line matching the regexp; the characters "$n", where n is a 1877 digit other than zero, are replaced by the text matched by the 1878 corresponding backreference expression (aka group). The special 1879 meaning of "$n" in this context can be suppressed by preceding it 1880 by a backslash. 1881<p> 1882 (This operand only applies to the commands s, a, i, c and y and is 1883 ignored by all other commands). 1884 * @return the command builder to allow for method chaining. Method 1885 * chaining is used here to create command chains. Adding a command 1886 * to the chain usually means that the previous command <i>pipes</i> 1887 * its output to the added command (the pipe symbol in unix) 1888 */ 1889 public static Unix4jCommandBuilder sed(SedOptions options, String string1, String string2) { 1890 return builder().sed(options, string1, string2); 1891 } 1892 /** 1893 * Executes the sed command specified by the given options or executes 1894 the substitute command s if no command option has been declared. 1895 <p> 1896 The string1 operand usually contains the regular expression matched 1897 against a line for all commands except for command y where string1 1898 contains the source characters for the translation. 1899 <p> 1900 The string2 operand contains the replacement string for the 1901 substitute command s. It contains the appended, inserted or changed 1902 text for the commands a, i and c, respectively, and the destination 1903 characters for the translate command y. All other commands ignore 1904 the string2 operand. 1905 * <p> 1906 * Note that the method returns the command builder to allow for command 1907 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1908 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1909 * 1910 * @param options Sed options and commands 1911 * @param string1 Regular expression matched against a line for all commands except 1912 for command y where string1 contains the source characters for the 1913 translation. 1914 * @param string2 Replacement string for substitute command s; appended, inserted or 1915 changed text for a, i and c command; destination characters for 1916 translate command y; ignored by all other commands. 1917 <p> 1918 If string2 is a replacement string for the substitute command: the 1919 characters "$0" appearing in the replacement are replaced 1920 by the line matching the regexp; the characters "$n", where n is a 1921 digit other than zero, are replaced by the text matched by the 1922 corresponding backreference expression (aka group). The special 1923 meaning of "$n" in this context can be suppressed by preceding it 1924 by a backslash. 1925<p> 1926 (This operand only applies to the commands s, a, i, c and y and is 1927 ignored by all other commands). 1928 * @param occurrence Substitute for the given occurrences only of the regexp found within 1929 the matched string; the occurrence indices are one-based. If empty 1930 or omitted, all occurrences are substituted. 1931 <p> 1932 (This operand only applies to the substitute command and is ignored 1933 by all other commands). 1934 * @return the command builder to allow for method chaining. Method 1935 * chaining is used here to create command chains. Adding a command 1936 * to the chain usually means that the previous command <i>pipes</i> 1937 * its output to the added command (the pipe symbol in unix) 1938 */ 1939 public static Unix4jCommandBuilder sed(SedOptions options, String string1, String string2, int... occurrence) { 1940 return builder().sed(options, string1, string2, occurrence); 1941 } 1942 /** 1943 * Sort the lines of all the specified files together and writes the 1944 result to the standard output. 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 The sort algorithm used is guaranteed to be stable: lines considered 1952 equal will not be reordered as a result of the sort. If two lines 1953 originate from different input files, the index of the file in the 1954 input arguments list defines the ordering of the lines. 1955 * <p> 1956 * Note that the method returns the command builder to allow for command 1957 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1958 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1959 * 1960 * @param args String arguments defining the options and operands for the command. 1961 Options can be specified by acronym (with a leading dash "-") or by 1962 long name (with two leading dashes "--"). Operands other than the 1963 default "--paths" operand have to be prefixed with the operand 1964 name (e.g. "--comparator" for a subsequent comparator operand value). 1965 * @return the command builder to allow for method chaining. Method 1966 * chaining is used here to create command chains. Adding a command 1967 * to the chain usually means that the previous command <i>pipes</i> 1968 * its output to the added command (the pipe symbol in unix) 1969 */ 1970 public static Unix4jCommandBuilder sort(String... args) { 1971 return builder().sort(args); 1972 } 1973 /** 1974 * Sort the lines of all the specified files together and writes the 1975 result to the standard output. 1976<p> 1977 Comparisons are based on the entire line without line ending. The 1978 collating sequence of the current locale is used to perform the 1979 comparisons. 1980<p> 1981 The sort algorithm used is guaranteed to be stable: lines considered 1982 equal will not be reordered as a result of the sort. If two lines 1983 originate from different input files, the index of the file in the 1984 input arguments list defines the ordering of the lines. 1985 * <p> 1986 * Note that the method returns the command builder to allow for command 1987 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1988 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1989 * 1990 * @param files The files to be sorted or merged; relative paths are not resolved 1991 (use the string paths argument to enable relative path resolving 1992 based on the current working directory). 1993 * @return the command builder to allow for method chaining. Method 1994 * chaining is used here to create command chains. Adding a command 1995 * to the chain usually means that the previous command <i>pipes</i> 1996 * its output to the added command (the pipe symbol in unix) 1997 */ 1998 public static Unix4jCommandBuilder sort(java.io.File... files) { 1999 return builder().sort(files); 2000 } 2001 /** 2002 * Sort the lines of all the specified inputs together and writes the 2003 result to the standard output. 2004<p> 2005 Comparisons are based on the entire line without line ending. The 2006 collating sequence of the current locale is used to perform the 2007 comparisons. 2008<p> 2009 The sort algorithm used is guaranteed to be stable: lines considered 2010 equal will not be reordered as a result of the sort. If two lines 2011 originate from different inputs, the index of the input in the 2012 arguments list defines the ordering of the lines. 2013 * <p> 2014 * Note that the method returns the command builder to allow for command 2015 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2016 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2017 * 2018 * @param inputs The inputs to be sorted or merged. 2019 * @return the command builder to allow for method chaining. Method 2020 * chaining is used here to create command chains. Adding a command 2021 * to the chain usually means that the previous command <i>pipes</i> 2022 * its output to the added command (the pipe symbol in unix) 2023 */ 2024 public static Unix4jCommandBuilder sort(org.unix4j.io.Input... inputs) { 2025 return builder().sort(inputs); 2026 } 2027 /** 2028 * Sort the lines of all the specified files together and writes the 2029 result to the standard output. 2030 <p> 2031 Line comparisons are based on the specified {@code comparator}. 2032 <p> 2033 The sort algorithm used is guaranteed to be stable: lines considered 2034 equal will not be reordered as a result of the sort. If two lines 2035 originate from different input files, the index of the file in the 2036 input arguments list defines the ordering of the lines. 2037 * <p> 2038 * Note that the method returns the command builder to allow for command 2039 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2040 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2041 * 2042 * @param comparator The comparator to use for the line comparisons. 2043 * @param files The files to be sorted or merged; relative paths are not resolved 2044 (use the string paths argument to enable relative path resolving 2045 based on the current working directory). 2046 * @return the command builder to allow for method chaining. Method 2047 * chaining is used here to create command chains. Adding a command 2048 * to the chain usually means that the previous command <i>pipes</i> 2049 * its output to the added command (the pipe symbol in unix) 2050 */ 2051 public static Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) { 2052 return builder().sort(comparator, files); 2053 } 2054 /** 2055 * Sort the lines of all the specified files together and writes the 2056 result to the standard output. 2057 <p> 2058 Line comparisons are based on the specified {@code comparator}. 2059 <p> 2060 The sort algorithm used is guaranteed to be stable: lines considered 2061 equal will not be reordered as a result of the sort. If two lines 2062 originate from different input files, the index of the file in the 2063 input arguments list defines the ordering of the lines. 2064 * <p> 2065 * Note that the method returns the command builder to allow for command 2066 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2067 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2068 * 2069 * @param comparator The comparator to use for the line comparisons. 2070 * @param paths Path names of the files to be sorted, merged, or checked; wildcards * 2071 and ? are supported; relative paths are resolved on the 2072 basis of the current working directory. 2073 * @return the command builder to allow for method chaining. Method 2074 * chaining is used here to create command chains. Adding a command 2075 * to the chain usually means that the previous command <i>pipes</i> 2076 * its output to the added command (the pipe symbol in unix) 2077 */ 2078 public static Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) { 2079 return builder().sort(comparator, paths); 2080 } 2081 /** 2082 * Sort the lines of all the specified inputs together and writes the 2083 result to the standard output. 2084<p> 2085 Line comparisons are based on the specified {@code comparator}. 2086<p> 2087 The sort algorithm used is guaranteed to be stable: lines considered 2088 equal will not be reordered as a result of the sort. If two lines 2089 originate from different inputs, the index of the input in the 2090 arguments list defines the ordering of the lines. 2091 * <p> 2092 * Note that the method returns the command builder to allow for command 2093 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2094 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2095 * 2096 * @param comparator The comparator to use for the line comparisons. 2097 * @param inputs The inputs to be sorted or merged. 2098 * @return the command builder to allow for method chaining. Method 2099 * chaining is used here to create command chains. Adding a command 2100 * to the chain usually means that the previous command <i>pipes</i> 2101 * its output to the added command (the pipe symbol in unix) 2102 */ 2103 public static Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, org.unix4j.io.Input... inputs) { 2104 return builder().sort(comparator, inputs); 2105 } 2106 /** 2107 * Sorts, merges, or sequence checks the lines the lines of all the 2108 specified files together and writes the result to the standard 2109 output. 2110 <p> 2111 Comparisons are based on the entire line without line ending. The 2112 collating sequence of the current locale is used to perform the 2113 comparisons. 2114 <p> 2115 The sort algorithm used is guaranteed to be stable: lines considered 2116 equal will not be reordered as a result of the sort. If two lines 2117 originate from different input files, the index of the file in the 2118 input arguments list defines the ordering of the lines. 2119 * <p> 2120 * Note that the method returns the command builder to allow for command 2121 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2122 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2123 * 2124 * @param options The options for the sort command. 2125 * @param files The files to be sorted or merged; relative paths are not resolved 2126 (use the string paths argument to enable relative path resolving 2127 based on the current working directory). 2128 * @return the command builder to allow for method chaining. Method 2129 * chaining is used here to create command chains. Adding a command 2130 * to the chain usually means that the previous command <i>pipes</i> 2131 * its output to the added command (the pipe symbol in unix) 2132 */ 2133 public static Unix4jCommandBuilder sort(SortOptions options, java.io.File... files) { 2134 return builder().sort(options, files); 2135 } 2136 /** 2137 * Sorts, merges, or sequence checks the lines the lines of all the 2138 specified files together and writes the result to the standard 2139 output. 2140 <p> 2141 Comparisons are based on the entire line without line ending. The 2142 collating sequence of the current locale is used to perform the 2143 comparisons. 2144 <p> 2145 The sort algorithm used is guaranteed to be stable: lines considered 2146 equal will not be reordered as a result of the sort. If two lines 2147 originate from different input files, the index of the file in the 2148 input arguments list defines the ordering of the lines. 2149 * <p> 2150 * Note that the method returns the command builder to allow for command 2151 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2152 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2153 * 2154 * @param options The options for the sort command. 2155 * @param paths Path names of the files to be sorted, merged, or checked; wildcards * 2156 and ? are supported; relative paths are resolved on the 2157 basis of the current working directory. 2158 * @return the command builder to allow for method chaining. Method 2159 * chaining is used here to create command chains. Adding a command 2160 * to the chain usually means that the previous command <i>pipes</i> 2161 * its output to the added command (the pipe symbol in unix) 2162 */ 2163 public static Unix4jCommandBuilder sort(SortOptions options, String... paths) { 2164 return builder().sort(options, paths); 2165 } 2166 /** 2167 * Sorts, merges, or sequence checks the lines the lines of all the 2168 specified inputs together and writes the result to the standard 2169 output. 2170<p> 2171 Comparisons are based on the entire line without line ending. The 2172 collating sequence of the current locale is used to perform the 2173 comparisons. 2174<p> 2175 The sort algorithm used is guaranteed to be stable: lines considered 2176 equal will not be reordered as a result of the sort. If two lines 2177 originate from different inputs, the index of the input in the 2178 arguments list defines the ordering of the lines. 2179 * <p> 2180 * Note that the method returns the command builder to allow for command 2181 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2182 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2183 * 2184 * @param options The options for the sort command. 2185 * @param inputs The inputs to be sorted or merged. 2186 * @return the command builder to allow for method chaining. Method 2187 * chaining is used here to create command chains. Adding a command 2188 * to the chain usually means that the previous command <i>pipes</i> 2189 * its output to the added command (the pipe symbol in unix) 2190 */ 2191 public static Unix4jCommandBuilder sort(SortOptions options, org.unix4j.io.Input... inputs) { 2192 return builder().sort(options, inputs); 2193 } 2194 /** 2195 * Sorts, merges, or sequence checks the lines the lines of all the 2196 specified files together and writes the result to the standard 2197 output. 2198 <p> 2199 Line comparisons are based on the specified {@code comparator}. 2200 All comparison related options except for {@code --reverse} are 2201 ignored. 2202 <p> 2203 The sort algorithm used is guaranteed to be stable: lines considered 2204 equal will not be reordered as a result of the sort. If two lines 2205 originate from different input files, the index of the file in the 2206 input arguments list defines the ordering of the lines. 2207 * <p> 2208 * Note that the method returns the command builder to allow for command 2209 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2210 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2211 * 2212 * @param options The options for the sort command. 2213 * @param comparator The comparator to use for the line comparisons. 2214 * @param files The files to be sorted or merged; relative paths are not resolved 2215 (use the string paths argument to enable relative path resolving 2216 based on the current working directory). 2217 * @return the command builder to allow for method chaining. Method 2218 * chaining is used here to create command chains. Adding a command 2219 * to the chain usually means that the previous command <i>pipes</i> 2220 * its output to the added command (the pipe symbol in unix) 2221 */ 2222 public static Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) { 2223 return builder().sort(options, comparator, files); 2224 } 2225 /** 2226 * Sorts, merges, or sequence checks the lines the lines of all the 2227 specified files together and writes the result to the standard 2228 output. 2229 <p> 2230 Line comparisons are based on the specified {@code comparator}. 2231 All comparison related options except for {@code --reverse} are 2232 ignored. 2233 <p> 2234 The sort algorithm used is guaranteed to be stable: lines considered 2235 equal will not be reordered as a result of the sort. If two lines 2236 originate from different input files, the index of the file in the 2237 input arguments list defines the ordering of the lines. 2238 * <p> 2239 * Note that the method returns the command builder to allow for command 2240 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2241 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2242 * 2243 * @param options The options for the sort command. 2244 * @param comparator The comparator to use for the line comparisons. 2245 * @param paths Path names of the files to be sorted, merged, or checked; wildcards * 2246 and ? are supported; relative paths are resolved on the 2247 basis of the current working directory. 2248 * @return the command builder to allow for method chaining. Method 2249 * chaining is used here to create command chains. Adding a command 2250 * to the chain usually means that the previous command <i>pipes</i> 2251 * its output to the added command (the pipe symbol in unix) 2252 */ 2253 public static Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) { 2254 return builder().sort(options, comparator, paths); 2255 } 2256 /** 2257 * Sorts, merges, or sequence checks the lines the lines of all the 2258 specified inputs together and writes the result to the standard 2259 output. 2260<p> 2261 Line comparisons are based on the specified {@code comparator}. 2262 All comparison related options except for {@code --reverse} are 2263 ignored. 2264<p> 2265 The sort algorithm used is guaranteed to be stable: lines considered 2266 equal will not be reordered as a result of the sort. If two lines 2267 originate from different inputs, the index of the input in the 2268 arguments list defines the ordering of the lines. 2269 * <p> 2270 * Note that the method returns the command builder to allow for command 2271 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2272 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2273 * 2274 * @param options The options for the sort command. 2275 * @param comparator The comparator to use for the line comparisons. 2276 * @param inputs The inputs to be sorted or merged. 2277 * @return the command builder to allow for method chaining. Method 2278 * chaining is used here to create command chains. Adding a command 2279 * to the chain usually means that the previous command <i>pipes</i> 2280 * its output to the added command (the pipe symbol in unix) 2281 */ 2282 public static Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, org.unix4j.io.Input... inputs) { 2283 return builder().sort(options, comparator, inputs); 2284 } 2285 /** 2286 * Reads the last n lines from each of the files specified and writes 2287 them to the standard output. If more than a single file is 2288 specified, each file is preceded by a header consisting of the 2289 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2290 of the file. 2291<p> 2292 Options can be specified by acronym (with a leading dash "-") or by 2293 long name (with two leading dashes "--"). Operands other than the 2294 default "--paths" operand have to be prefixed with the operand 2295 name. 2296 * <p> 2297 * Note that the method returns the command builder to allow for command 2298 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2299 * of the returned builder (see {@link Unix4jCommandBuilder} 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. "--count" for a subsequent count operand value). 2306 * @return the command 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 added command (the pipe symbol in unix) 2310 */ 2311 public static Unix4jCommandBuilder tail(String... args) { 2312 return builder().tail(args); 2313 } 2314 /** 2315 * Reads the last 10 lines from each of the specified files and writes 2316 them to the standard output. If more than a single file is 2317 specified, each file is preceded by a header consisting of the 2318 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2319 of the file. 2320 * <p> 2321 * Note that the method returns the command builder to allow for command 2322 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2323 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2324 * 2325 * @param files The input files to be filtered; relative paths are not resolved (use 2326 the string paths argument to enable relative path resolving based on 2327 the current working directory). 2328 * @return the command builder to allow for method chaining. Method 2329 * chaining is used here to create command chains. Adding a command 2330 * to the chain usually means that the previous command <i>pipes</i> 2331 * its output to the added command (the pipe symbol in unix) 2332 */ 2333 public static Unix4jCommandBuilder tail(java.io.File... files) { 2334 return builder().tail(files); 2335 } 2336 /** 2337 * Reads the last 10 lines from each of the specified inputs and writes 2338 them to the standard output. If more than a single input is 2339 specified, each one is preceded by a header consisting of the 2340 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 2341 string representation. 2342 * <p> 2343 * Note that the method returns the command builder to allow for command 2344 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2345 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2346 * 2347 * @param inputs The inputs to be filtered. 2348 * @return the command builder to allow for method chaining. Method 2349 * chaining is used here to create command chains. Adding a command 2350 * to the chain usually means that the previous command <i>pipes</i> 2351 * its output to the added command (the pipe symbol in unix) 2352 */ 2353 public static Unix4jCommandBuilder tail(org.unix4j.io.Input... inputs) { 2354 return builder().tail(inputs); 2355 } 2356 /** 2357 * Reads the last {@code count} lines from each of the specified files 2358 and writes them to the standard output. If more than a single file 2359 is specified, each file is preceded by a header consisting of the 2360 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2361 of the file. 2362 * <p> 2363 * Note that the method returns the command builder to allow for command 2364 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2365 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2366 * 2367 * @param count The last {@code count} lines of each input file are 2368 copied to standard output, starting from 1 (characters instead of 2369 lines if the {@code -c} option is specified, and offset from start 2370 instead of end with {@code -s} option). Must be a non-negative 2371 integer or an exception is thrown. If {@code count} is greater than 2372 the number number of lines (characters) in the input, the 2373 application will not error and send the whole file to the output. 2374 * @param files The input files to be filtered; relative paths are not resolved (use 2375 the string paths argument to enable relative path resolving based on 2376 the current working directory). 2377 * @return the command builder to allow for method chaining. Method 2378 * chaining is used here to create command chains. Adding a command 2379 * to the chain usually means that the previous command <i>pipes</i> 2380 * its output to the added command (the pipe symbol in unix) 2381 */ 2382 public static Unix4jCommandBuilder tail(long count, java.io.File... files) { 2383 return builder().tail(count, files); 2384 } 2385 /** 2386 * Reads the last {@code count} lines from each of the specified files 2387 and writes them to the standard output. If more than a single file 2388 is specified, each file is preceded by a header consisting of the 2389 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2390 of the file. 2391 * <p> 2392 * Note that the method returns the command builder to allow for command 2393 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2394 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2395 * 2396 * @param count The last {@code count} lines of each input file are 2397 copied to standard output, starting from 1 (characters instead of 2398 lines if the {@code -c} option is specified, and offset from start 2399 instead of end with {@code -s} option). Must be a non-negative 2400 integer or an exception is thrown. If {@code count} is greater than 2401 the number number of lines (characters) in the input, the 2402 application will not error and send the whole file to the output. 2403 * @param paths Path names of the input files to be filtered; wildcards * and ? are 2404 supported; relative paths are resolved on the basis of the current 2405 working directory. 2406 * @return the command builder to allow for method chaining. Method 2407 * chaining is used here to create command chains. Adding a command 2408 * to the chain usually means that the previous command <i>pipes</i> 2409 * its output to the added command (the pipe symbol in unix) 2410 */ 2411 public static Unix4jCommandBuilder tail(long count, String... paths) { 2412 return builder().tail(count, paths); 2413 } 2414 /** 2415 * Reads the last {@code count} lines from each of the specified inputs 2416 and writes them to the standard output. If more than a single input 2417 is specified, each file is preceded by a header consisting of the 2418 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 2419 string representation. 2420 * <p> 2421 * Note that the method returns the command builder to allow for command 2422 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2423 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2424 * 2425 * @param count The last {@code count} lines of each input file are 2426 copied to standard output, starting from 1 (characters instead of 2427 lines if the {@code -c} option is specified, and offset from start 2428 instead of end with {@code -s} option). Must be a non-negative 2429 integer or an exception is thrown. If {@code count} is greater than 2430 the number number of lines (characters) in the input, the 2431 application will not error and send the whole file to the output. 2432 * @param inputs The inputs to be filtered. 2433 * @return the command builder to allow for method chaining. Method 2434 * chaining is used here to create command chains. Adding a command 2435 * to the chain usually means that the previous command <i>pipes</i> 2436 * its output to the added command (the pipe symbol in unix) 2437 */ 2438 public static Unix4jCommandBuilder tail(long count, org.unix4j.io.Input... inputs) { 2439 return builder().tail(count, inputs); 2440 } 2441 /** 2442 * Reads the last {@code count} lines or characters from each of the 2443 specified files and writes them to the standard output. If more than 2444 a single file is specified and the {@code -q} option is not 2445 specified, each file is preceded by a header consisting of the 2446 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2447 of the file. 2448 * <p> 2449 * Note that the method returns the command builder to allow for command 2450 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2451 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2452 * 2453 * @param options Options for the tail command. 2454 * @param count The last {@code count} lines of each input file are 2455 copied to standard output, starting from 1 (characters instead of 2456 lines if the {@code -c} option is specified, and offset from start 2457 instead of end with {@code -s} option). Must be a non-negative 2458 integer or an exception is thrown. If {@code count} is greater than 2459 the number number of lines (characters) in the input, the 2460 application will not error and send the whole file to the output. 2461 * @param files The input files to be filtered; relative paths are not resolved (use 2462 the string paths argument to enable relative path resolving based on 2463 the current working directory). 2464 * @return the command builder to allow for method chaining. Method 2465 * chaining is used here to create command chains. Adding a command 2466 * to the chain usually means that the previous command <i>pipes</i> 2467 * its output to the added command (the pipe symbol in unix) 2468 */ 2469 public static Unix4jCommandBuilder tail(TailOptions options, long count, java.io.File... files) { 2470 return builder().tail(options, count, files); 2471 } 2472 /** 2473 * Reads the last {@code count} lines or characters from each of the 2474 specified files and writes them to the standard output. If more than 2475 a single file is specified and the {@code -q} option is not 2476 specified, each file is preceded by a header consisting of the 2477 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2478 of the file. 2479 * <p> 2480 * Note that the method returns the command builder to allow for command 2481 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2482 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2483 * 2484 * @param options Options for the tail command. 2485 * @param count The last {@code count} lines of each input file are 2486 copied to standard output, starting from 1 (characters instead of 2487 lines if the {@code -c} option is specified, and offset from start 2488 instead of end with {@code -s} option). Must be a non-negative 2489 integer or an exception is thrown. If {@code count} is greater than 2490 the number number of lines (characters) in the input, the 2491 application will not error and send the whole file to the output. 2492 * @param paths Path names of the input files to be filtered; wildcards * and ? are 2493 supported; relative paths are resolved on the basis of the current 2494 working directory. 2495 * @return the command builder to allow for method chaining. Method 2496 * chaining is used here to create command chains. Adding a command 2497 * to the chain usually means that the previous command <i>pipes</i> 2498 * its output to the added command (the pipe symbol in unix) 2499 */ 2500 public static Unix4jCommandBuilder tail(TailOptions options, long count, String... paths) { 2501 return builder().tail(options, count, paths); 2502 } 2503 /** 2504 * Reads the last {@code count} lines or characters from each of the 2505 specified inputs and writes them to the standard output. If more than 2506 a single input is specified and the {@code -q} option is not 2507 specified, each file is preceded by a header consisting of the 2508 string {@code "==> XXX <=="} where {@code "XXX"} is the input's 2509 string representation. 2510 * <p> 2511 * Note that the method returns the command builder to allow for command 2512 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2513 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2514 * 2515 * @param options Options for the tail command. 2516 * @param count The last {@code count} lines of each input file are 2517 copied to standard output, starting from 1 (characters instead of 2518 lines if the {@code -c} option is specified, and offset from start 2519 instead of end with {@code -s} option). Must be a non-negative 2520 integer or an exception is thrown. If {@code count} is greater than 2521 the number number of lines (characters) in the input, the 2522 application will not error and send the whole file to the output. 2523 * @param inputs The inputs to be filtered. 2524 * @return the command builder to allow for method chaining. Method 2525 * chaining is used here to create command chains. Adding a command 2526 * to the chain usually means that the previous command <i>pipes</i> 2527 * its output to the added command (the pipe symbol in unix) 2528 */ 2529 public static Unix4jCommandBuilder tail(TailOptions options, long count, org.unix4j.io.Input... inputs) { 2530 return builder().tail(options, count, inputs); 2531 } 2532 /** 2533 * Reads from the specified input {@code file} and compares adjacent 2534 lines, writing one copy of each input line to the standard output. 2535 The second and succeeding copies of repeated adjacent input lines 2536 are not written to the output. 2537 <p> 2538 Note that repeated lines in the input are not detected if they are 2539 not adjacent (see --global or -g option); sorted input lines always 2540 result in unique output lines. 2541 * <p> 2542 * Note that the method returns the command builder to allow for command 2543 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2544 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2545 * 2546 * @param file The files or directories used as starting point for the listing; 2547 relative paths are not resolved (use the string path argument to 2548 enable relative path resolving based on the current working 2549 directory). 2550 * @return the command builder to allow for method chaining. Method 2551 * chaining is used here to create command chains. Adding a command 2552 * to the chain usually means that the previous command <i>pipes</i> 2553 * its output to the added command (the pipe symbol in unix) 2554 */ 2555 public static Unix4jCommandBuilder uniq(java.io.File file) { 2556 return builder().uniq(file); 2557 } 2558 /** 2559 * Reads the file specified by its {@code path} and compares adjacent 2560 lines, writing one copy of each input line to the standard output. 2561 The second and succeeding copies of repeated adjacent input lines 2562 are not written to the output. 2563 <p> 2564 Note that repeated lines in the input are not detected if they are 2565 not adjacent (see --global or -g option); sorted input lines always 2566 result in unique output lines. 2567 * <p> 2568 * Note that the method returns the command builder to allow for command 2569 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2570 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2571 * 2572 * @param path The files or directories used as starting point for the listing; 2573 wildcards * and ? are supported; relative paths are resolved on the 2574 basis of the current working directory. 2575 * @return the command builder to allow for method chaining. Method 2576 * chaining is used here to create command chains. Adding a command 2577 * to the chain usually means that the previous command <i>pipes</i> 2578 * its output to the added command (the pipe symbol in unix) 2579 */ 2580 public static Unix4jCommandBuilder uniq(String path) { 2581 return builder().uniq(path); 2582 } 2583 /** 2584 * Reads from the specified input {@code file} and compares adjacent 2585 lines, writing one copy of each input line to the standard output. 2586 The second and succeeding copies of repeated adjacent input lines 2587 are not written to the output. 2588 <p> 2589 Note that repeated non-adjacent lines in the input are only detected 2590 with the --global or -g option. In other words, unique output lines 2591 are guaranteed only if either (a) the --global or -g option is 2592 specified, or (b) the input lines are sorted. 2593 * <p> 2594 * Note that the method returns the command builder to allow for command 2595 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2596 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2597 * 2598 * @param options The options defining the uniqueness details for the output lines. 2599 * @param file The files or directories used as starting point for the listing; 2600 relative paths are not resolved (use the string path argument to 2601 enable relative path resolving based on the current working 2602 directory). 2603 * @return the command builder to allow for method chaining. Method 2604 * chaining is used here to create command chains. Adding a command 2605 * to the chain usually means that the previous command <i>pipes</i> 2606 * its output to the added command (the pipe symbol in unix) 2607 */ 2608 public static Unix4jCommandBuilder uniq(UniqOptions options, java.io.File file) { 2609 return builder().uniq(options, file); 2610 } 2611 /** 2612 * Reads the file specified by its {@code path} and compares adjacent 2613 lines, writing one copy of each input line to the standard output. 2614 The second and succeeding copies of repeated adjacent input lines 2615 are not written to the output. 2616 <p> 2617 Note that repeated non-adjacent lines in the input are only detected 2618 with the --global or -g option. In other words, unique output lines 2619 are guaranteed only if either (a) the --global or -g option is 2620 specified, or (b) the input lines are sorted. 2621 * <p> 2622 * Note that the method returns the command builder to allow for command 2623 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2624 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2625 * 2626 * @param options The options defining the uniqueness details for the output lines. 2627 * @param path The files or directories used as starting point for the listing; 2628 wildcards * and ? are supported; relative paths are resolved on the 2629 basis of the current working directory. 2630 * @return the command builder to allow for method chaining. Method 2631 * chaining is used here to create command chains. Adding a command 2632 * to the chain usually means that the previous command <i>pipes</i> 2633 * its output to the added command (the pipe symbol in unix) 2634 */ 2635 public static Unix4jCommandBuilder uniq(UniqOptions options, String path) { 2636 return builder().uniq(options, path); 2637 } 2638 /** 2639 * Executes a count of lines, words and chars contained in each input 2640 file and writes them to the standard output. If more than one input 2641 file is specified, a line of cumulative counts for all the files is 2642 displayed on a separate line after the output for the last file. 2643 * <p> 2644 * Note that the method returns the command builder to allow for command 2645 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2646 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2647 * 2648 * @param files The input files; relative paths are not resolved (use the string 2649 paths argument to enable relative path resolving based on the 2650 current working directory). 2651 * @return the command builder to allow for method chaining. Method 2652 * chaining is used here to create command chains. Adding a command 2653 * to the chain usually means that the previous command <i>pipes</i> 2654 * its output to the added command (the pipe symbol in unix) 2655 */ 2656 public static Unix4jCommandBuilder wc(java.io.File... files) { 2657 return builder().wc(files); 2658 } 2659 /** 2660 * Executes a count of lines, words and chars contained in each input 2661 and writes them to the standard output. If more than one input 2662 is specified, a line of cumulative counts for all the inputs is 2663 displayed on a separate line after the output for the last input. 2664 * <p> 2665 * Note that the method returns the command builder to allow for command 2666 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2667 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2668 * 2669 * @param inputs The inputs. 2670 * @return the command builder to allow for method chaining. Method 2671 * chaining is used here to create command chains. Adding a command 2672 * to the chain usually means that the previous command <i>pipes</i> 2673 * its output to the added command (the pipe symbol in unix) 2674 */ 2675 public static Unix4jCommandBuilder wc(org.unix4j.io.Input... inputs) { 2676 return builder().wc(inputs); 2677 } 2678 /** 2679 * Executes a one or more counts, depending on the given options, in 2680 each of the given input files and writes them to the standard 2681 output. If more than one input file is specified, a line of 2682 cumulative counts for all the files is displayed on a separate line 2683 after the output for the last file. 2684 * <p> 2685 * Note that the method returns the command builder to allow for command 2686 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2687 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2688 * 2689 * @param options The options defining command behavior. 2690 * @param files The input files; relative paths are not resolved (use the string 2691 paths argument to enable relative path resolving based on the 2692 current working directory). 2693 * @return the command builder to allow for method chaining. Method 2694 * chaining is used here to create command chains. Adding a command 2695 * to the chain usually means that the previous command <i>pipes</i> 2696 * its output to the added command (the pipe symbol in unix) 2697 */ 2698 public static Unix4jCommandBuilder wc(WcOptions options, java.io.File... files) { 2699 return builder().wc(options, files); 2700 } 2701 /** 2702 * Executes a one or more counts, depending on the given options, in 2703 each of the given input files and writes them to the standard 2704 output. If more than one input file is specified, a line of 2705 cumulative counts for all the files is displayed on a separate line 2706 after the output for the last file. 2707 * <p> 2708 * Note that the method returns the command builder to allow for command 2709 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2710 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2711 * 2712 * @param options The options defining command behavior. 2713 * @param paths Path names of the input files; wildcards * and ? are supported; 2714 relative paths are resolved on the basis of the current working 2715 directory. 2716 * @return the command builder to allow for method chaining. Method 2717 * chaining is used here to create command chains. Adding a command 2718 * to the chain usually means that the previous command <i>pipes</i> 2719 * its output to the added command (the pipe symbol in unix) 2720 */ 2721 public static Unix4jCommandBuilder wc(WcOptions options, String[] paths) { 2722 return builder().wc(options, paths); 2723 } 2724 /** 2725 * Executes a one or more counts, depending on the given options, in 2726 each of the given inputs and writes them to the standard 2727 output. If more than one inputs is specified, a line of 2728 cumulative counts for all the inputs is displayed on a separate line 2729 after the output for the last input. 2730 * <p> 2731 * Note that the method returns the command builder to allow for command 2732 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2733 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2734 * 2735 * @param options The options defining command behavior. 2736 * @param inputs The inputs. 2737 * @return the command builder to allow for method chaining. Method 2738 * chaining is used here to create command chains. Adding a command 2739 * to the chain usually means that the previous command <i>pipes</i> 2740 * its output to the added command (the pipe symbol in unix) 2741 */ 2742 public static Unix4jCommandBuilder wc(WcOptions options, org.unix4j.io.Input... inputs) { 2743 return builder().wc(options, inputs); 2744 } 2745 2746 // no instances 2747 private Unix4j() { 2748 super(); 2749 } 2750}