001package org.unix4j; 002 003import org.unix4j.builder.Unix4jCommandBuilder; 004import org.unix4j.builder.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 files and writes them to the 100 standard output; the given options define the details of the output 101 format. The files are processed in command-argument order. 102 * <p> 103 * Note that the method returns the command builder to allow for command 104 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 105 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 106 * 107 * @param options Options for the cat command. 108 * @param files The input files to be printed; relative paths are not resolved (use 109 the string path argument to enable relative path resolving based on 110 the current working directory). 111 * @return the command builder to allow for method chaining. Method 112 * chaining is used here to create command chains. Adding a command 113 * to the chain usually means that the previous command <i>pipes</i> 114 * its output to the added command (the pipe symbol in unix) 115 */ 116 public static Unix4jCommandBuilder cat(CatOptions options, java.io.File... files) { 117 return builder().cat(options, files); 118 } 119 /** 120 * Reads the lines from the specified files and writes them to the 121 standard output; the given options define the details of the output 122 format. The path arguments are expanded if wildcards are used and 123 processed in command-argument order. 124 * <p> 125 * Note that the method returns the command builder to allow for command 126 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 127 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 128 * 129 * @param options Options for the cat command. 130 * @param paths Pathnames of the input files to be printed; wildcards * and ? are 131 supported; relative paths are resolved on the basis of the current 132 working directory. 133 * @return the command builder to allow for method chaining. Method 134 * chaining is used here to create command chains. Adding a command 135 * to the chain usually means that the previous command <i>pipes</i> 136 * its output to the added command (the pipe symbol in unix) 137 */ 138 public static Unix4jCommandBuilder cat(CatOptions options, String... paths) { 139 return builder().cat(options, paths); 140 } 141 /** 142 * Changes the current directory to the user home directory as defined 143 by the execution context (usually the directory specified by the 144 {@code "user.home"} system property). 145 * <p> 146 * Note that the method returns the command builder to allow for command 147 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 148 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 149 * 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 cd() { 156 return builder().cd(); 157 } 158 /** 159 * The current working directory is changed to the given file. If the 160 specified file argument does not represent a valid directory, an 161 exception is thrown. Note that relative paths are not resolved with 162 the (old) current working directory. Use the String path to enable 163 relative path resolving and wildcards. 164 * <p> 165 * Note that the method returns the command builder to allow for command 166 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 167 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 168 * 169 * @param file the file to use as input; relative paths are not resolved (use the 170 string path argument to enable relative path resolving based on the 171 current working directory). 172 * @return the command builder to allow for method chaining. Method 173 * chaining is used here to create command chains. Adding a command 174 * to the chain usually means that the previous command <i>pipes</i> 175 * its output to the added command (the pipe symbol in unix) 176 */ 177 public static Unix4jCommandBuilder cd(java.io.File file) { 178 return builder().cd(file); 179 } 180 /** 181 * The current working directory is changed to the given file. Relative 182 paths are resolved on the basis of the (old) current working 183 directory. Wildcards are possible if the first matching file 184 represents a directory. If the first file specified by the given 185 path argument is not a valid directory, an exception is thrown. 186 * <p> 187 * Note that the method returns the command builder to allow for command 188 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 189 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 190 * 191 * @param path the directory to become the new current working directory; 192 wildcards * and ? are supported; relative paths are resolved on the 193 basis of the current working directory. 194 * @return the command builder to allow for method chaining. Method 195 * chaining is used here to create command chains. Adding a command 196 * to the chain usually means that the previous command <i>pipes</i> 197 * its output to the added command (the pipe symbol in unix) 198 */ 199 public static Unix4jCommandBuilder cd(String path) { 200 return builder().cd(path); 201 } 202 /** 203 * Writes any of the specified strings, separated by single blank 204 ({@code ' '}) characters to the standard output suppressing the 205 trailing line ending if the {@code "-n"} option is specified. 206 * <p> 207 * Note that the method returns the command builder to allow for command 208 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 209 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 210 * 211 * @param args String arguments defining the options for the command and the 212 strings to be written to the output. Options can be specified by 213 acronym (with a leading dash "-") or by long name (with two leading 214 dashes "--"). 215 * @return the command builder to allow for method chaining. Method 216 * chaining is used here to create command chains. Adding a command 217 * to the chain usually means that the previous command <i>pipes</i> 218 * its output to the added command (the pipe symbol in unix) 219 */ 220 public static Unix4jCommandBuilder echo(String... args) { 221 return builder().echo(args); 222 } 223 /** 224 * Writes the specified string followed by a newline character to 225 the standard output suppressing the trailing line ending if the 226 {@code -n} option is specified. 227 * <p> 228 * Note that the method returns the command builder to allow for command 229 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 230 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 231 * 232 * @param options Options for the echo command. 233 * @param string A string to be written to standard output. 234 * @return the command builder to allow for method chaining. Method 235 * chaining is used here to create command chains. Adding a command 236 * to the chain usually means that the previous command <i>pipes</i> 237 * its output to the added command (the pipe symbol in unix) 238 */ 239 public static Unix4jCommandBuilder echo(EchoOptions options, String string) { 240 return builder().echo(options, string); 241 } 242 /** 243 * Writes any of the specified strings, separated by single blank 244 ({@code ' '}) characters to the standard output suppressing the 245 trailing line ending if the {@code -n} option is specified. 246 * <p> 247 * Note that the method returns the command builder to allow for command 248 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 249 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 250 * 251 * @param options Options for the echo command. 252 * @param strings Strings to be written to standard output, separated by single blank 253 characters. 254 * @return the command builder to allow for method chaining. Method 255 * chaining is used here to create command chains. Adding a command 256 * to the chain usually means that the previous command <i>pipes</i> 257 * its output to the added command (the pipe symbol in unix) 258 */ 259 public static Unix4jCommandBuilder echo(EchoOptions options, String... strings) { 260 return builder().echo(options, strings); 261 } 262 /** 263 * Finds all files matching the search criteria specified by the given 264 arguments and writes the file names to the standard output. 265 <p> 266 Options can be specified by acronym (with a leading dash "-") or by 267 long name (with two leading dashes "--"). Operands other than the 268 default "--name" operand have to be prefixed with the operand name. 269 <p> 270 The files names written to the output are relative paths referring 271 to the working directory (or -- if provided -- relative to the path 272 given after the {@code "--path"} operand name). 273 * <p> 274 * Note that the method returns the command builder to allow for command 275 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 276 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 277 * 278 * @param args String arguments defining the options and operands for the command. 279 Options can be specified by acronym (with a leading dash "-") or by 280 long name (with two leading dashes "--"). Operands other than the 281 default "--path" operand have to be prefixed with the operand name 282 (e.g. "--name" for subsequent path operand values). 283 * @return the command builder to allow for method chaining. Method 284 * chaining is used here to create command chains. Adding a command 285 * to the chain usually means that the previous command <i>pipes</i> 286 * its output to the added command (the pipe symbol in unix) 287 */ 288 public static Unix4jCommandBuilder find(String... args) { 289 return builder().find(args); 290 } 291 /** 292 * Finds all files in or below the directory specified by {@code path} 293 and writes the file names to the standard output. 294<p> 295 The files names written to the output are paths relative to the 296 specified {@code path} operand. 297 * <p> 298 * Note that the method returns the command builder to allow for command 299 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 300 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 301 * 302 * @param path Starting point for the search in the directory hierarchy; 303 wildcards * and ? are supported; relative paths are resolved on the 304 basis of the current working directory. 305 * @return the command builder to allow for method chaining. Method 306 * chaining is used here to create command chains. Adding a command 307 * to the chain usually means that the previous command <i>pipes</i> 308 * its output to the added command (the pipe symbol in unix) 309 */ 310 public static Unix4jCommandBuilder find(String path) { 311 return builder().find(path); 312 } 313 /** 314 * Finds all files matching the specified {@code name} in or below the 315 directory specified by {@code path} and writes the file names to 316 the standard output. 317 <p> 318 The files names written to the output are paths relative to the 319 specified {@code path} operand. 320 * <p> 321 * Note that the method returns the command builder to allow for command 322 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 323 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 324 * 325 * @param path Starting point for the search in the directory hierarchy; 326 wildcards * and ? are supported; relative paths are resolved on the 327 basis of the current working directory. 328 * @param name Name pattern to match the file name after removing the path with the 329 leading directories; wildcards * and ? are supported, or full 330 regular expressions if either of the options {@code -regex (-r)} or 331 {@code -iregex (-i)} is specified. 332 * @return the command builder to allow for method chaining. Method 333 * chaining is used here to create command chains. Adding a command 334 * to the chain usually means that the previous command <i>pipes</i> 335 * its output to the added command (the pipe symbol in unix) 336 */ 337 public static Unix4jCommandBuilder find(String path, String name) { 338 return builder().find(path, name); 339 } 340 /** 341 * Finds all files matching the specified file {@code size} in or below 342 the user's current working directory and writes the file names to 343 the standard output. Matching files use at least {@code size} bytes 344 on disk if {@code size} is positive, or at most {@code abs(size)} 345 bytes if {@code size} is zero or negative. 346 <p> 347 The files names written to the output are relative paths referring 348 to the working directory. 349 * <p> 350 * Note that the method returns the command builder to allow for command 351 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 352 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 353 * 354 * @param size Consider only files using at least {@code size} bytes if {@code size} 355 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 356 or negative. 357 * @return the command builder to allow for method chaining. Method 358 * chaining is used here to create command chains. Adding a command 359 * to the chain usually means that the previous command <i>pipes</i> 360 * its output to the added command (the pipe symbol in unix) 361 */ 362 public static Unix4jCommandBuilder find(long size) { 363 return builder().find(size); 364 } 365 /** 366 * Finds all files matching the specified file {@code size} in or below 367 the directory specified by {@code path} and writes the file names 368 to the standard output. Matching files use at least {@code size} 369 bytes on disk if {@code size} is positive, or at most 370 {@code abs(size)} bytes if {@code size} is zero or negative. 371<p> 372 The files names written to the output are paths relative to the 373 specified {@code path} operand. 374 * <p> 375 * Note that the method returns the command builder to allow for command 376 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 377 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 378 * 379 * @param path Starting point for the search in the directory hierarchy; 380 wildcards * and ? are supported; relative paths are resolved on the 381 basis of the current working directory. 382 * @param size Consider only files using at least {@code size} bytes if {@code size} 383 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 384 or negative. 385 * @return the command builder to allow for method chaining. Method 386 * chaining is used here to create command chains. Adding a command 387 * to the chain usually means that the previous command <i>pipes</i> 388 * its output to the added command (the pipe symbol in unix) 389 */ 390 public static Unix4jCommandBuilder find(String path, long size) { 391 return builder().find(path, size); 392 } 393 /** 394 * Finds all files matching the specified file {@code name} and 395 {@code size} in or below the user's current working directory and 396 writes the file names to the standard output. Matching files use 397 at least {@code size} bytes on disk if {@code size} is positive, 398 or at most {@code abs(size)} bytes if {@code size} is zero or 399 negative. 400<p> 401 The files names written to the output are relative paths referring 402 to the working directory. 403 * <p> 404 * Note that the method returns the command builder to allow for command 405 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 406 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 407 * 408 * @param size Consider only files using at least {@code size} bytes if {@code size} 409 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 410 or negative. 411 * @param name Name pattern to match the file name after removing the path with the 412 leading directories; wildcards * and ? are supported, or full 413 regular expressions if either of the options {@code -regex (-r)} or 414 {@code -iregex (-i)} is specified. 415 * @return the command builder to allow for method chaining. Method 416 * chaining is used here to create command chains. Adding a command 417 * to the chain usually means that the previous command <i>pipes</i> 418 * its output to the added command (the pipe symbol in unix) 419 */ 420 public static Unix4jCommandBuilder find(long size, String name) { 421 return builder().find(size, name); 422 } 423 /** 424 * Finds all files matching the specified file {@code name} and 425 {@code size} in or below the directory specified by {@code path} 426 and writes the file names to the standard output. Matching files 427 use at least {@code size} bytes on disk if {@code size} is positive, 428 or at most {@code abs(size)} bytes if {@code size} is zero or 429 negative. 430<p> 431 The files names written to the output are paths relative to the 432 specified {@code path} operand. 433 * <p> 434 * Note that the method returns the command builder to allow for command 435 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 436 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 437 * 438 * @param path Starting point for the search in the directory hierarchy; 439 wildcards * and ? are supported; relative paths are resolved on the 440 basis of the current working directory. 441 * @param size Consider only files using at least {@code size} bytes if {@code size} 442 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 443 or negative. 444 * @param name Name pattern to match the file name after removing the path with the 445 leading directories; wildcards * and ? are supported, or full 446 regular expressions if either of the options {@code -regex (-r)} or 447 {@code -iregex (-i)} is specified. 448 * @return the command builder to allow for method chaining. Method 449 * chaining is used here to create command chains. Adding a command 450 * to the chain usually means that the previous command <i>pipes</i> 451 * its output to the added command (the pipe symbol in unix) 452 */ 453 public static Unix4jCommandBuilder find(String path, long size, String name) { 454 return builder().find(path, size, name); 455 } 456 /** 457 * Finds all files matching the specified {@code name} in or below the 458 user's current working directory and writes the file names to the 459 standard output. 460 <p> 461 The files names written to the output are relative paths referring 462 to the working directory. 463 * <p> 464 * Note that the method returns the command builder to allow for command 465 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 466 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 467 * 468 * @param options Options for the file search. 469 * @param name Name pattern to match the file name after removing the path with the 470 leading directories; wildcards * and ? are supported, or full 471 regular expressions if either of the options {@code -regex (-r)} or 472 {@code -iregex (-i)} is specified. 473 * @return the command builder to allow for method chaining. Method 474 * chaining is used here to create command chains. Adding a command 475 * to the chain usually means that the previous command <i>pipes</i> 476 * its output to the added command (the pipe symbol in unix) 477 */ 478 public static Unix4jCommandBuilder find(FindOptions options, String name) { 479 return builder().find(options, name); 480 } 481 /** 482 * Finds all files matching the specified {@code name} in or below the 483 directory specified by {@code path} and writes the file names to 484 the standard output. 485<p> 486 The files names written to the output are paths relative to the 487 specified {@code path} operand. 488 * <p> 489 * Note that the method returns the command builder to allow for command 490 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 491 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 492 * 493 * @param options Options for the file search. 494 * @param path Starting point for the search in the directory hierarchy; 495 wildcards * and ? are supported; relative paths are resolved on the 496 basis of the current working directory. 497 * @param name Name pattern to match the file name after removing the path with the 498 leading directories; wildcards * and ? are supported, or full 499 regular expressions if either of the options {@code -regex (-r)} or 500 {@code -iregex (-i)} is specified. 501 * @return the command builder to allow for method chaining. Method 502 * chaining is used here to create command chains. Adding a command 503 * to the chain usually means that the previous command <i>pipes</i> 504 * its output to the added command (the pipe symbol in unix) 505 */ 506 public static Unix4jCommandBuilder find(FindOptions options, String path, String name) { 507 return builder().find(options, path, name); 508 } 509 /** 510 * Finds all files matching the specified file {@code size} in or below 511 the user's current working directory and writes the file names to 512 the standard output. Matching files use at least {@code size} bytes 513 on disk if {@code size} is positive, or at most {@code abs(size)} 514 bytes if {@code size} is zero or negative. 515<p> 516 The files names written to the output are relative paths referring 517 to the working directory. 518 * <p> 519 * Note that the method returns the command builder to allow for command 520 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 521 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 522 * 523 * @param options Options for the file search. 524 * @param size Consider only files using at least {@code size} bytes if {@code size} 525 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 526 or negative. 527 * @return the command builder to allow for method chaining. Method 528 * chaining is used here to create command chains. Adding a command 529 * to the chain usually means that the previous command <i>pipes</i> 530 * its output to the added command (the pipe symbol in unix) 531 */ 532 public static Unix4jCommandBuilder find(FindOptions options, long size) { 533 return builder().find(options, size); 534 } 535 /** 536 * Finds all files matching the specified file {@code size} in or below 537 the directory specified by {@code path} and writes the file names 538 to the standard output. Matching files use at least {@code size} 539 bytes on disk if {@code size} is positive, or at most 540 {@code abs(size)} bytes if {@code size} is zero or negative. 541<p> 542 The files names written to the output are paths relative to the 543 specified {@code path} operand. 544 * <p> 545 * Note that the method returns the command builder to allow for command 546 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 547 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 548 * 549 * @param options Options for the file search. 550 * @param path Starting point for the search in the directory hierarchy; 551 wildcards * and ? are supported; relative paths are resolved on the 552 basis of the current working directory. 553 * @param size Consider only files using at least {@code size} bytes if {@code size} 554 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 555 or negative. 556 * @return the command builder to allow for method chaining. Method 557 * chaining is used here to create command chains. Adding a command 558 * to the chain usually means that the previous command <i>pipes</i> 559 * its output to the added command (the pipe symbol in unix) 560 */ 561 public static Unix4jCommandBuilder find(FindOptions options, String path, long size) { 562 return builder().find(options, path, size); 563 } 564 /** 565 * Finds all files that have been created, modified or accessed before 566 or after the specified {@code time} (depending on the given 567 {@code -time...} options). The names of the matching files found in 568 or below the user's current working directory are written to the 569 standard output. 570<p> 571 The files names written to the output are relative paths referring 572 to the working directory. 573 * <p> 574 * Note that the method returns the command builder to allow for command 575 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 576 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 577 * 578 * @param options Options for the file search. 579 * @param time Consider only files that have been created, modified or accessed 580 before or after the specified {@code time} operand; consider the 581 {@code -time...} options for details of the comparison. 582 * @return the command builder to allow for method chaining. Method 583 * chaining is used here to create command chains. Adding a command 584 * to the chain usually means that the previous command <i>pipes</i> 585 * its output to the added command (the pipe symbol in unix) 586 */ 587 public static Unix4jCommandBuilder find(FindOptions options, java.util.Date time) { 588 return builder().find(options, time); 589 } 590 /** 591 * Finds all files that have been created, modified or accessed before 592 or after the specified {@code time} (depending on the given 593 {@code -time...} options). The names of the matching files found in 594 or below the directory specified by {@code path} are written to 595 the standard output. 596<p> 597 The files names written to the output are paths relative to the 598 specified {@code path} operand. 599 * <p> 600 * Note that the method returns the command builder to allow for command 601 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 602 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 603 * 604 * @param options Options for the file search. 605 * @param path Starting point for the search in the directory hierarchy; 606 wildcards * and ? are supported; relative paths are resolved on the 607 basis of the current working directory. 608 * @param time Consider only files that have been created, modified or accessed 609 before or after the specified {@code time} operand; consider the 610 {@code -time...} options for details of the comparison. 611 * @return the command builder to allow for method chaining. Method 612 * chaining is used here to create command chains. Adding a command 613 * to the chain usually means that the previous command <i>pipes</i> 614 * its output to the added command (the pipe symbol in unix) 615 */ 616 public static Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time) { 617 return builder().find(options, path, time); 618 } 619 /** 620 * Finds all files matching the specified file {@code name} and 621 {@code size} in or below the user's current working directory and 622 writes the file names to the standard output. Matching files use 623 at least {@code size} bytes on disk if {@code size} is positive, or 624 at most {@code abs(size)} bytes if {@code size} is zero or negative. 625<p> 626 The files names written to the output are relative paths referring 627 to the working directory. 628 * <p> 629 * Note that the method returns the command builder to allow for command 630 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 631 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 632 * 633 * @param options Options for the file search. 634 * @param size Consider only files using at least {@code size} bytes if {@code size} 635 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 636 or negative. 637 * @param name Name pattern to match the file name after removing the path with the 638 leading directories; wildcards * and ? are supported, or full 639 regular expressions if either of the options {@code -regex (-r)} or 640 {@code -iregex (-i)} is specified. 641 * @return the command builder to allow for method chaining. Method 642 * chaining is used here to create command chains. Adding a command 643 * to the chain usually means that the previous command <i>pipes</i> 644 * its output to the added command (the pipe symbol in unix) 645 */ 646 public static Unix4jCommandBuilder find(FindOptions options, long size, String name) { 647 return builder().find(options, size, name); 648 } 649 /** 650 * Finds all files matching the specified file {@code name} and 651 {@code size} in or below the directory specified by {@code path} 652 and writes the file names to the standard output. Matching files 653 use at least {@code size} bytes on disk if {@code size} is positive, 654 or at most {@code abs(size)} bytes if {@code size} is zero or 655 negative. 656<p> 657 The files names written to the output are paths relative to the 658 specified {@code path} operand. 659 * <p> 660 * Note that the method returns the command builder to allow for command 661 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 662 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 663 * 664 * @param options Options for the file search. 665 * @param path Starting point for the search in the directory hierarchy; 666 wildcards * and ? are supported; relative paths are resolved on the 667 basis of the current working directory. 668 * @param size Consider only files using at least {@code size} bytes if {@code size} 669 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 670 or negative. 671 * @param name Name pattern to match the file name after removing the path with the 672 leading directories; wildcards * and ? are supported, or full 673 regular expressions if either of the options {@code -regex (-r)} or 674 {@code -iregex (-i)} is specified. 675 * @return the command builder to allow for method chaining. Method 676 * chaining is used here to create command chains. Adding a command 677 * to the chain usually means that the previous command <i>pipes</i> 678 * its output to the added command (the pipe symbol in unix) 679 */ 680 public static Unix4jCommandBuilder find(FindOptions options, String path, long size, String name) { 681 return builder().find(options, path, size, name); 682 } 683 /** 684 * Finds all files matching the given {@code name} that have been 685 created, modified or accessed before or after the specified 686 {@code time} (depending on the given {@code -time...} options). The 687 names of the matching files found in or below the user's current 688 working directory are written to the standard output. 689<p> 690 The files names written to the output are relative paths referring 691 to the working directory. 692 * <p> 693 * Note that the method returns the command builder to allow for command 694 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 695 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 696 * 697 * @param options Options for the file search. 698 * @param time Consider only files that have been created, modified or accessed 699 before or after the specified {@code time} operand; consider the 700 {@code -time...} options for details of the comparison. 701 * @param name Name pattern to match the file name after removing the path with the 702 leading directories; wildcards * and ? are supported, or full 703 regular expressions if either of the options {@code -regex (-r)} or 704 {@code -iregex (-i)} is specified. 705 * @return the command builder to allow for method chaining. Method 706 * chaining is used here to create command chains. Adding a command 707 * to the chain usually means that the previous command <i>pipes</i> 708 * its output to the added command (the pipe symbol in unix) 709 */ 710 public static Unix4jCommandBuilder find(FindOptions options, java.util.Date time, String name) { 711 return builder().find(options, time, name); 712 } 713 /** 714 * Finds all files matching the given {@code name} that have been 715 created, modified or accessed before or after the specified 716 {@code time} (depending on the given {@code -time...} options). The 717 names of the matching files found in or below the directory 718 specified by {@code path} are written to the standard output. 719<p> 720 The files names written to the output are paths relative to the 721 specified {@code path} operand. 722 * <p> 723 * Note that the method returns the command builder to allow for command 724 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 725 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 726 * 727 * @param options Options for the file search. 728 * @param path Starting point for the search in the directory hierarchy; 729 wildcards * and ? are supported; relative paths are resolved on the 730 basis of the current working directory. 731 * @param time Consider only files that have been created, modified or accessed 732 before or after the specified {@code time} operand; consider the 733 {@code -time...} options for details of the comparison. 734 * @param name Name pattern to match the file name after removing the path with the 735 leading directories; wildcards * and ? are supported, or full 736 regular expressions if either of the options {@code -regex (-r)} or 737 {@code -iregex (-i)} is specified. 738 * @return the command builder to allow for method chaining. Method 739 * chaining is used here to create command chains. Adding a command 740 * to the chain usually means that the previous command <i>pipes</i> 741 * its output to the added command (the pipe symbol in unix) 742 */ 743 public static Unix4jCommandBuilder find(FindOptions options, String path, java.util.Date time, String name) { 744 return builder().find(options, path, time, name); 745 } 746 /** 747 * Finds all files matching the given {@code name} and {@code size} and 748 have been created, modified or accessed before or after the specified 749 {@code time} (depending on the given {@code -time...} options). 750 <p> 751 Matching files use at least {@code size} bytes on disk if 752 {@code size} is positive, or at most {@code abs(size)} bytes if 753 {@code size} is zero or negative. The names of the matching files 754 found in or below the user's current working directory are written 755 to the standard output. 756<p> 757 The files names written to the output are relative paths referring 758 to the working directory. 759 * <p> 760 * Note that the method returns the command builder to allow for command 761 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 762 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 763 * 764 * @param options Options for the file search. 765 * @param size Consider only files using at least {@code size} bytes if {@code size} 766 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 767 or negative. 768 * @param time Consider only files that have been created, modified or accessed 769 before or after the specified {@code time} operand; consider the 770 {@code -time...} options for details of the comparison. 771 * @param name Name pattern to match the file name after removing the path with the 772 leading directories; wildcards * and ? are supported, or full 773 regular expressions if either of the options {@code -regex (-r)} or 774 {@code -iregex (-i)} is specified. 775 * @return the command builder to allow for method chaining. Method 776 * chaining is used here to create command chains. Adding a command 777 * to the chain usually means that the previous command <i>pipes</i> 778 * its output to the added command (the pipe symbol in unix) 779 */ 780 public static Unix4jCommandBuilder find(FindOptions options, long size, java.util.Date time, String name) { 781 return builder().find(options, size, time, name); 782 } 783 /** 784 * Finds all files matching the given {@code name} and {@code size} and 785 have been created, modified or accessed before or after the specified 786 {@code time} (depending on the given {@code -time...} options). 787 <p> 788 Matching files use at least {@code size} bytes on disk if 789 {@code size} is positive, or at most {@code abs(size)} bytes if 790 {@code size} is zero or negative. The names of the matching files 791 found in or below the directory specified by {@code path} are 792 written to the standard output. 793<p> 794 The files names written to the output are paths relative to the 795 specified {@code path} operand. 796 * <p> 797 * Note that the method returns the command builder to allow for command 798 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 799 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 800 * 801 * @param options Options for the file search. 802 * @param path Starting point for the search in the directory hierarchy; 803 wildcards * and ? are supported; relative paths are resolved on the 804 basis of the current working directory. 805 * @param size Consider only files using at least {@code size} bytes if {@code size} 806 is positive, or at most {@code abs(size)} bytes if {@code size} is zero 807 or negative. 808 * @param time Consider only files that have been created, modified or accessed 809 before or after the specified {@code time} operand; consider the 810 {@code -time...} options for details of the comparison. 811 * @param name Name pattern to match the file name after removing the path with the 812 leading directories; wildcards * and ? are supported, or full 813 regular expressions if either of the options {@code -regex (-r)} or 814 {@code -iregex (-i)} is specified. 815 * @return the command builder to allow for method chaining. Method 816 * chaining is used here to create command chains. Adding a command 817 * to the chain usually means that the previous command <i>pipes</i> 818 * its output to the added command (the pipe symbol in unix) 819 */ 820 public static Unix4jCommandBuilder find(FindOptions options, String path, long size, java.util.Date time, String name) { 821 return builder().find(options, path, size, time, name); 822 } 823 /** 824 * Uses the given string as input for the next command. If the string 825 contains line ending codes (UNIX or DOS independent from the host 826 operating system), the string is split into multiple lines. 827 * <p> 828 * Note that the method returns the command builder to allow for command 829 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 830 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 831 * 832 * @param string the string to use as input 833 * @return the command builder to allow for method chaining. Method 834 * chaining is used here to create command chains. Adding a command 835 * to the chain usually means that the previous command <i>pipes</i> 836 * its output to the added command (the pipe symbol in unix) 837 */ 838 public static Unix4jCommandBuilder fromString(String string) { 839 return builder().fromString(string); 840 } 841 /** 842 * Uses the given strings as input for the next command. Each string 843 usually represents a single line of the input; however, if any of 844 the strings contains line ending codes (UNIX or DOS independent from 845 the host operating system), it is split into multiple lines. 846 * <p> 847 * Note that the method returns the command builder to allow for command 848 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 849 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 850 * 851 * @param strings the input lines 852 * @return the command builder to allow for method chaining. Method 853 * chaining is used here to create command chains. Adding a command 854 * to the chain usually means that the previous command <i>pipes</i> 855 * its output to the added command (the pipe symbol in unix) 856 */ 857 public static Unix4jCommandBuilder fromStrings(String... strings) { 858 return builder().fromStrings(strings); 859 } 860 /** 861 * Uses the strings in the specified {@code input} collection as input 862 lines for the next command. Each string usually represents a single 863 line of the input; however, if any of the strings contains line 864 ending codes (UNIX or DOS independent from the host operating 865 system), it is split into multiple lines. 866 * <p> 867 * Note that the method returns the command builder to allow for command 868 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 869 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 870 * 871 * @param lines collection with input lines 872 * @return the command builder to allow for method chaining. Method 873 * chaining is used here to create command chains. Adding a command 874 * to the chain usually means that the previous command <i>pipes</i> 875 * its output to the added command (the pipe symbol in unix) 876 */ 877 public static Unix4jCommandBuilder from(java.util.Collection<? extends String> lines) { 878 return builder().from(lines); 879 } 880 /** 881 * Redirects the contents of the given file into the next command. This 882 is essentially equivalent to the following syntax in a unix command 883 shell: {@code path > ...} 884 * <p> 885 * Note that the method returns the command builder to allow for command 886 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 887 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 888 * 889 * @param path the file to use as input; wildcards * and ? are supported; relative 890 paths are resolved on the basis of the current working directory. 891 * @return the command builder to allow for method chaining. Method 892 * chaining is used here to create command chains. Adding a command 893 * to the chain usually means that the previous command <i>pipes</i> 894 * its output to the added command (the pipe symbol in unix) 895 */ 896 public static Unix4jCommandBuilder fromFile(String path) { 897 return builder().fromFile(path); 898 } 899 /** 900 * Redirects the contents of the given file into the next command. This 901 is essentially equivalent to the following syntax in a unix command 902 shell: {@code file > ...} 903 * <p> 904 * Note that the method returns the command builder to allow for command 905 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 906 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 907 * 908 * @param file the file to use as input; relative paths are not resolved (use the 909 string path argument to enable relative path resolving based on the 910 current working directory). 911 * @return the command builder to allow for method chaining. Method 912 * chaining is used here to create command chains. Adding a command 913 * to the chain usually means that the previous command <i>pipes</i> 914 * its output to the added command (the pipe symbol in unix) 915 */ 916 public static Unix4jCommandBuilder fromFile(java.io.File file) { 917 return builder().fromFile(file); 918 } 919 /** 920 * Reads from the given resource relative to the classpath and 921 redirects the contents into the next command. The resource is 922 usually a file or URL on the classpath. The resource is read using 923 {@link Class#getResourceAsStream(String)}. 924 * <p> 925 * Note that the method returns the command builder to allow for command 926 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 927 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 928 * 929 * @param resource a path to the file to redirect to the next command. The will need 930 to be on the classpath. If the file is in the root directory, the 931 filename should be prefixed with a forward slash. e.g.: 932 {@code "/test-file.txt"} 933 <p> 934 If the file is in a package, then the package should be specified 935 prefixed with a forward slash, and with each dot "." replaced with a 936 forward slash. e.g.: 937 {@code "/org/company/mypackage/test-file.txt"} 938 * @return the command builder to allow for method chaining. Method 939 * chaining is used here to create command chains. Adding a command 940 * to the chain usually means that the previous command <i>pipes</i> 941 * its output to the added command (the pipe symbol in unix) 942 */ 943 public static Unix4jCommandBuilder fromResource(String resource) { 944 return builder().fromResource(resource); 945 } 946 /** 947 * Reads from the given input stream and redirects the contents into 948 the next command. 949 * <p> 950 * Note that the method returns the command builder to allow for command 951 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 952 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 953 * 954 * @param stream the input stream to read from 955 * @return the command builder to allow for method chaining. Method 956 * chaining is used here to create command chains. Adding a command 957 * to the chain usually means that the previous command <i>pipes</i> 958 * its output to the added command (the pipe symbol in unix) 959 */ 960 public static Unix4jCommandBuilder from(java.io.InputStream stream) { 961 return builder().from(stream); 962 } 963 /** 964 * Uses the given reader and redirects the read input into the next 965 command. 966 * <p> 967 * Note that the method returns the command builder to allow for command 968 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 969 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 970 * 971 * @param reader the reader used to read the input 972 * @return the command builder to allow for method chaining. Method 973 * chaining is used here to create command chains. Adding a command 974 * to the chain usually means that the previous command <i>pipes</i> 975 * its output to the added command (the pipe symbol in unix) 976 */ 977 public static Unix4jCommandBuilder from(java.io.Reader reader) { 978 return builder().from(reader); 979 } 980 /** 981 * Reads from the given URL and redirects the contents into the next 982 command. 983 * <p> 984 * Note that the method returns the command builder to allow for command 985 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 986 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 987 * 988 * @param url the URL to read from 989 * @return the command builder to allow for method chaining. Method 990 * chaining is used here to create command chains. Adding a command 991 * to the chain usually means that the previous command <i>pipes</i> 992 * its output to the added command (the pipe symbol in unix) 993 */ 994 public static Unix4jCommandBuilder from(java.net.URL url) { 995 return builder().from(url); 996 } 997 /** 998 * Reads from the given input object and redirects the contents into 999 the next command. 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 input the input object to read from 1006 * @return the command builder to allow for method chaining. Method 1007 * chaining is used here to create command chains. Adding a command 1008 * to the chain usually means that the previous command <i>pipes</i> 1009 * its output to the added command (the pipe symbol in unix) 1010 */ 1011 public static Unix4jCommandBuilder from(org.unix4j.io.Input input) { 1012 return builder().from(input); 1013 } 1014 /** 1015 * Filters the lines from the specified input files and writes the 1016 matching lines to the standard output. Every line is matched against 1017 the given {@code regexp} string using case-sensitive comparison. 1018 Line endings are not relevant for the comparison. 1019 * <p> 1020 * Note that the method returns the command builder to allow for command 1021 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1022 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1023 * 1024 * @param regexp Lines will be printed which match the given regular expression. The 1025 {@code regexp} string is surrounded with ".*" on both sides unless 1026 the {@code --wholeLine} option is specified. If the 1027 {@code --fixedStrings} option is used, plain string comparison is 1028 used instead of regular expression matching. 1029 * @param files The input files to be searched for the pattern; relative paths are 1030 not resolved (use the string paths argument to enable relative path 1031 resolving based on the current working directory). 1032 * @return the command builder to allow for method chaining. Method 1033 * chaining is used here to create command chains. Adding a command 1034 * to the chain usually means that the previous command <i>pipes</i> 1035 * its output to the added command (the pipe symbol in unix) 1036 */ 1037 public static Unix4jCommandBuilder grep(String regexp, java.io.File... files) { 1038 return builder().grep(regexp, files); 1039 } 1040 /** 1041 * Filters the lines from the specified input files and writes the 1042 matching lines to the standard output. Every line is matched against 1043 the given regular expression {@code pattern} using case-sensitive 1044 comparison. Line endings are not relevant for the comparison. 1045 * <p> 1046 * Note that the method returns the command builder to allow for command 1047 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1048 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1049 * 1050 * @param pattern Lines will be printed which match the given pattern. 1051 * @param files The input files to be searched for the pattern; relative paths are 1052 not resolved (use the string paths argument to enable relative path 1053 resolving based on the current working directory). 1054 * @return the command builder to allow for method chaining. Method 1055 * chaining is used here to create command chains. Adding a command 1056 * to the chain usually means that the previous command <i>pipes</i> 1057 * its output to the added command (the pipe symbol in unix) 1058 */ 1059 public static Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, java.io.File... files) { 1060 return builder().grep(pattern, files); 1061 } 1062 /** 1063 * Filters the lines from the specified input files and writes the 1064 matching lines to the standard output. Every line is matched against 1065 the given regular expression {@code pattern} using case-sensitive 1066 comparison. Line endings are not relevant for the comparison. 1067 * <p> 1068 * Note that the method returns the command builder to allow for command 1069 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1070 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1071 * 1072 * @param pattern Lines will be printed which match the given pattern. 1073 * @param paths Pathnames of the input files to be searched for the pattern; 1074 wildcards * and ? are supported; relative paths are resolved on the 1075 basis of the current working directory. 1076 * @return the command builder to allow for method chaining. Method 1077 * chaining is used here to create command chains. Adding a command 1078 * to the chain usually means that the previous command <i>pipes</i> 1079 * its output to the added command (the pipe symbol in unix) 1080 */ 1081 public static Unix4jCommandBuilder grep(java.util.regex.Pattern pattern, String... paths) { 1082 return builder().grep(pattern, paths); 1083 } 1084 /** 1085 * Filters the input lines from the specified input files and writes 1086 the matching lines to the standard output. Every line is matched 1087 against the given {@code regexp} string; the exact comparison rules 1088 are defined by the specified matching {@code options}. 1089 * <p> 1090 * Note that the method returns the command builder to allow for command 1091 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1092 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1093 * 1094 * @param options The options defining the types of patterns and command behavior. 1095 * @param regexp Lines will be printed which match the given regular expression. The 1096 {@code regexp} string is surrounded with ".*" on both sides unless 1097 the {@code --wholeLine} option is specified. If the 1098 {@code --fixedStrings} option is used, plain string comparison is 1099 used instead of regular expression matching. 1100 * @param files The input files to be searched for the pattern; relative paths are 1101 not resolved (use the string paths argument to enable relative path 1102 resolving based on the current working directory). 1103 * @return the command builder to allow for method chaining. Method 1104 * chaining is used here to create command chains. Adding a command 1105 * to the chain usually means that the previous command <i>pipes</i> 1106 * its output to the added command (the pipe symbol in unix) 1107 */ 1108 public static Unix4jCommandBuilder grep(GrepOptions options, String regexp, java.io.File... files) { 1109 return builder().grep(options, regexp, files); 1110 } 1111 /** 1112 * Filters the input lines from the specified input files and writes 1113 the matching lines to the standard output. Every line is matched 1114 against the given {@code regexp} string; the exact comparison rules 1115 are defined by the specified matching {@code options}. 1116 * <p> 1117 * Note that the method returns the command builder to allow for command 1118 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1119 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1120 * 1121 * @param options The options defining the types of patterns and command behavior. 1122 * @param regexp Lines will be printed which match the given regular expression. The 1123 {@code regexp} string is surrounded with ".*" on both sides unless 1124 the {@code --wholeLine} option is specified. If the 1125 {@code --fixedStrings} option is used, plain string comparison is 1126 used instead of regular expression matching. 1127 * @param paths Pathnames of the input files to be searched for the pattern; 1128 wildcards * and ? are supported; relative paths are resolved on the 1129 basis of the current working directory. 1130 * @return the command builder to allow for method chaining. Method 1131 * chaining is used here to create command chains. Adding a command 1132 * to the chain usually means that the previous command <i>pipes</i> 1133 * its output to the added command (the pipe symbol in unix) 1134 */ 1135 public static Unix4jCommandBuilder grep(GrepOptions options, String regexp, String... paths) { 1136 return builder().grep(options, regexp, paths); 1137 } 1138 /** 1139 * Filters the input lines from the specified input files and writes 1140 the matching lines to the standard output. Every line is matched 1141 against the given regular expression {@code pattern}; the exact 1142 comparison rules are defined by the specified matching 1143 {@code options}. 1144 * <p> 1145 * Note that the method returns the command builder to allow for command 1146 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1147 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1148 * 1149 * @param options The options defining the types of patterns and command behavior. 1150 * @param pattern Lines will be printed which match the given pattern. 1151 * @param files The input files to be searched for the pattern; relative paths are 1152 not resolved (use the string paths argument to enable relative path 1153 resolving based on the current working directory). 1154 * @return the command builder to allow for method chaining. Method 1155 * chaining is used here to create command chains. Adding a command 1156 * to the chain usually means that the previous command <i>pipes</i> 1157 * its output to the added command (the pipe symbol in unix) 1158 */ 1159 public static Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, java.io.File... files) { 1160 return builder().grep(options, pattern, files); 1161 } 1162 /** 1163 * Filters the input lines from the specified input files and writes 1164 the matching lines to the standard output. Every line is matched 1165 against the given regular expression {@code pattern}; the exact 1166 comparison rules are defined by the specified matching 1167 {@code options}. 1168 * <p> 1169 * Note that the method returns the command builder to allow for command 1170 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1171 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1172 * 1173 * @param options The options defining the types of patterns and command behavior. 1174 * @param pattern Lines will be printed which match the given pattern. 1175 * @param paths Pathnames of the input files to be searched for the pattern; 1176 wildcards * and ? are supported; relative paths are resolved on the 1177 basis of the current working directory. 1178 * @return the command builder to allow for method chaining. Method 1179 * chaining is used here to create command chains. Adding a command 1180 * to the chain usually means that the previous command <i>pipes</i> 1181 * its output to the added command (the pipe symbol in unix) 1182 */ 1183 public static Unix4jCommandBuilder grep(GrepOptions options, java.util.regex.Pattern pattern, String... paths) { 1184 return builder().grep(options, pattern, paths); 1185 } 1186 /** 1187 * Reads the first 10 lines from each of the specified files and writes 1188 them to the standard output. If more than a single file is 1189 specified, each file is preceded by a header consisting of the 1190 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1191 of the file. 1192 * <p> 1193 * Note that the method returns the command builder to allow for command 1194 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1195 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1196 * 1197 * @param files The input files to be filtered; relative paths are not resolved (use 1198 the string paths argument to enable relative path resolving based on 1199 the current working directory). 1200 * @return the command builder to allow for method chaining. Method 1201 * chaining is used here to create command chains. Adding a command 1202 * to the chain usually means that the previous command <i>pipes</i> 1203 * its output to the added command (the pipe symbol in unix) 1204 */ 1205 public static Unix4jCommandBuilder head(java.io.File... files) { 1206 return builder().head(files); 1207 } 1208 /** 1209 * Reads the first {@code count} lines from each of the specified files 1210 and writes them to the standard output. If more than a single file 1211 is specified, each file is preceded by a header consisting of the 1212 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1213 of the file. 1214 * <p> 1215 * Note that the method returns the command builder to allow for command 1216 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1217 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1218 * 1219 * @param count The first {@code count} lines of each input file are 1220 copied to standard output, starting from 1 (characters instead of 1221 lines if the {@code -c} option is specified). Must be a non-negative 1222 integer or an exception is thrown. If {@code count} is greater than 1223 the number number of lines (characters) in the input, the 1224 application will not error and send the whole file to the output. 1225 * @param files The input files to be filtered; relative paths are not resolved (use 1226 the string paths argument to enable relative path resolving based on 1227 the current working directory). 1228 * @return the command builder to allow for method chaining. Method 1229 * chaining is used here to create command chains. Adding a command 1230 * to the chain usually means that the previous command <i>pipes</i> 1231 * its output to the added command (the pipe symbol in unix) 1232 */ 1233 public static Unix4jCommandBuilder head(long count, java.io.File... files) { 1234 return builder().head(count, files); 1235 } 1236 /** 1237 * Reads the first {@code count} lines from each of the specified files 1238 and writes them to the standard output. If more than a single file 1239 is specified, each file is preceded by a header consisting of the 1240 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1241 of the file. 1242 * <p> 1243 * Note that the method returns the command builder to allow for command 1244 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1245 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1246 * 1247 * @param count The first {@code count} lines of each input file are 1248 copied to standard output, starting from 1 (characters instead of 1249 lines if the {@code -c} option is specified). Must be a non-negative 1250 integer or an exception is thrown. If {@code count} is greater than 1251 the number number of lines (characters) in the input, the 1252 application will not error and send the whole file to the output. 1253 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 1254 supported; relative paths are resolved on the basis of the current 1255 working directory. 1256 * @return the command builder to allow for method chaining. Method 1257 * chaining is used here to create command chains. Adding a command 1258 * to the chain usually means that the previous command <i>pipes</i> 1259 * its output to the added command (the pipe symbol in unix) 1260 */ 1261 public static Unix4jCommandBuilder head(long count, String... paths) { 1262 return builder().head(count, paths); 1263 } 1264 /** 1265 * Reads the first {@code count} lines or characters from each of the 1266 specified files and writes them to the standard output. If more than 1267 a single file is specified and the {@code -q} option is not 1268 specified, each file is preceded by a header consisting of the 1269 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1270 of the file. 1271 * <p> 1272 * Note that the method returns the command builder to allow for command 1273 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1274 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1275 * 1276 * @param options Options for the head command. 1277 * @param count The first {@code count} lines of each input file are 1278 copied to standard output, starting from 1 (characters instead of 1279 lines if the {@code -c} option is specified). Must be a non-negative 1280 integer or an exception is thrown. If {@code count} is greater than 1281 the number number of lines (characters) in the input, the 1282 application will not error and send the whole file to the output. 1283 * @param files The input files to be filtered; relative paths are not resolved (use 1284 the string paths argument to enable relative path resolving based on 1285 the current working directory). 1286 * @return the command builder to allow for method chaining. Method 1287 * chaining is used here to create command chains. Adding a command 1288 * to the chain usually means that the previous command <i>pipes</i> 1289 * its output to the added command (the pipe symbol in unix) 1290 */ 1291 public static Unix4jCommandBuilder head(HeadOptions options, long count, java.io.File... files) { 1292 return builder().head(options, count, files); 1293 } 1294 /** 1295 * Reads the first {@code count} lines or characters from each of the 1296 specified files and writes them to the standard output. If more than 1297 a single file is specified and the {@code -q} option is not 1298 specified, each file is preceded by a header consisting of the 1299 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1300 of the file. 1301 * <p> 1302 * Note that the method returns the command builder to allow for command 1303 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1304 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1305 * 1306 * @param options Options for the head command. 1307 * @param count The first {@code count} lines of each input file are 1308 copied to standard output, starting from 1 (characters instead of 1309 lines if the {@code -c} option is specified). Must be a non-negative 1310 integer or an exception is thrown. If {@code count} is greater than 1311 the number number of lines (characters) in the input, the 1312 application will not error and send the whole file to the output. 1313 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 1314 supported; relative paths are resolved on the basis of the current 1315 working directory. 1316 * @return the command builder to allow for method chaining. Method 1317 * chaining is used here to create command chains. Adding a command 1318 * to the chain usually means that the previous command <i>pipes</i> 1319 * its output to the added command (the pipe symbol in unix) 1320 */ 1321 public static Unix4jCommandBuilder head(HeadOptions options, long count, String... paths) { 1322 return builder().head(options, count, paths); 1323 } 1324 /** 1325 * Lists all files and directories in the user's current working 1326 directory and writes them to the output. 1327 * <p> 1328 * Note that the method returns the command builder to allow for command 1329 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1330 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1331 * 1332 * @return the command builder to allow for method chaining. Method 1333 * chaining is used here to create command chains. Adding a command 1334 * to the chain usually means that the previous command <i>pipes</i> 1335 * its output to the added command (the pipe symbol in unix) 1336 */ 1337 public static Unix4jCommandBuilder ls() { 1338 return builder().ls(); 1339 } 1340 /** 1341 * Prints the name of the specified files and lists all files contained 1342 in directories for every directory in those files. 1343 <p> 1344 Options can be specified by acronym (with a leading dash "-") or by 1345 long name (with two leading dashes "--"). Operands other than the 1346 default "--paths" operand have to be prefixed with the operand 1347 name. 1348 * <p> 1349 * Note that the method returns the command builder to allow for command 1350 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1351 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1352 * 1353 * @param args String arguments defining the options and operands for the command. 1354 Options can be specified by acronym (with a leading dash "-") or by 1355 long name (with two leading dashes "--"). Operands other than the 1356 default "--paths" operand have to be prefixed with the operand 1357 name (e.g. "--count" for a subsequent count operand value). 1358 * @return the command builder to allow for method chaining. Method 1359 * chaining is used here to create command chains. Adding a command 1360 * to the chain usually means that the previous command <i>pipes</i> 1361 * its output to the added command (the pipe symbol in unix) 1362 */ 1363 public static Unix4jCommandBuilder ls(String... args) { 1364 return builder().ls(args); 1365 } 1366 /** 1367 * Prints the name of the given files and lists all files contained in 1368 directories for every directory in {@code files}. 1369 * <p> 1370 * Note that the method returns the command builder to allow for command 1371 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1372 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1373 * 1374 * @param files The files or directories used as starting point for the listing; 1375 relative paths are not resolved (use the string path argument to 1376 enable relative path resolving based on the current working 1377 directory). 1378 * @return the command builder to allow for method chaining. Method 1379 * chaining is used here to create command chains. Adding a command 1380 * to the chain usually means that the previous command <i>pipes</i> 1381 * its output to the added command (the pipe symbol in unix) 1382 */ 1383 public static Unix4jCommandBuilder ls(java.io.File... files) { 1384 return builder().ls(files); 1385 } 1386 /** 1387 * Lists all files and directories in the user's current working 1388 directory and writes them to the output using the given options 1389 specifying the details of the output format. 1390 * <p> 1391 * Note that the method returns the command builder to allow for command 1392 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1393 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1394 * 1395 * @param options The options defining the output format. 1396 * @return the command builder to allow for method chaining. Method 1397 * chaining is used here to create command chains. Adding a command 1398 * to the chain usually means that the previous command <i>pipes</i> 1399 * its output to the added command (the pipe symbol in unix) 1400 */ 1401 public static Unix4jCommandBuilder ls(LsOptions options) { 1402 return builder().ls(options); 1403 } 1404 /** 1405 * Prints the name of the given files and lists all files contained in 1406 directories for every directory in {@code files}. The given options 1407 define the details of the output format. 1408 * <p> 1409 * Note that the method returns the command builder to allow for command 1410 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1411 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1412 * 1413 * @param options The options defining the output format. 1414 * @param files The files or directories used as starting point for the listing; 1415 relative paths are not resolved (use the string path argument to 1416 enable relative path resolving based on the current working 1417 directory). 1418 * @return the command builder to allow for method chaining. Method 1419 * chaining is used here to create command chains. Adding a command 1420 * to the chain usually means that the previous command <i>pipes</i> 1421 * its output to the added command (the pipe symbol in unix) 1422 */ 1423 public static Unix4jCommandBuilder ls(LsOptions options, java.io.File... files) { 1424 return builder().ls(options, files); 1425 } 1426 /** 1427 * Prints the name of the given files and lists all files contained in 1428 directories for every directory in {@code files}. The given options 1429 define the details of the output format. 1430 * <p> 1431 * Note that the method returns the command builder to allow for command 1432 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1433 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1434 * 1435 * @param options The options defining the output format. 1436 * @param paths The files or directories used as starting point for the listing; 1437 wildcards * and ? are supported; relative paths are resolved on the 1438 basis of the current working directory. 1439 * @return the command builder to allow for method chaining. Method 1440 * chaining is used here to create command chains. Adding a command 1441 * to the chain usually means that the previous command <i>pipes</i> 1442 * its output to the added command (the pipe symbol in unix) 1443 */ 1444 public static Unix4jCommandBuilder ls(LsOptions options, String... paths) { 1445 return builder().ls(options, paths); 1446 } 1447 /** 1448 * Executes the sed script specified by the given arguments and writes 1449 the result to the standard output. 1450 <p> 1451 Options can be specified by acronym (with a leading dash "-") or by 1452 long name (with two leading dashes "--"). Operands other than the 1453 default "--script" operand have to be prefixed with the operand name. 1454 * <p> 1455 * Note that the method returns the command builder to allow for command 1456 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1457 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1458 * 1459 * @param args String arguments defining the options and operands for the command. 1460 Options can be specified by acronym (with a leading dash "-") or by 1461 long name (with two leading dashes "--"). Operands other than the 1462 default "--script" operand have to be prefixed with the operand name 1463 (e.g. "--occurrence" for subsequent occurrence indices). 1464 * @return the command builder to allow for method chaining. Method 1465 * chaining is used here to create command chains. Adding a command 1466 * to the chain usually means that the previous command <i>pipes</i> 1467 * its output to the added command (the pipe symbol in unix) 1468 */ 1469 public static Unix4jCommandBuilder sed(String... args) { 1470 return builder().sed(args); 1471 } 1472 /** 1473 * Executes the given sed script, such as "s/original/replacement/g". 1474 * <p> 1475 * Note that the method returns the command builder to allow for command 1476 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1477 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1478 * 1479 * @param script Sed script as one string, such as "s/original/replacement/g". 1480 * @return the command builder to allow for method chaining. Method 1481 * chaining is used here to create command chains. Adding a command 1482 * to the chain usually means that the previous command <i>pipes</i> 1483 * its output to the added command (the pipe symbol in unix) 1484 */ 1485 public static Unix4jCommandBuilder sed(String script) { 1486 return builder().sed(script); 1487 } 1488 /** 1489 * Substitutes the replacement string for instances of the regexp in 1490 the matched line. 1491 <p> 1492 An ampersand ('&') appearing in the replacement is be replaced 1493 by the line matching the regexp. The characters "\n", where n is a 1494 digit, are replaced by the text matched by the corresponding 1495 backreference expression. The special meaning of '&' and "\n" 1496 in this context can be suppressed by preceding it by a backslash. 1497<p> 1498 A line can be split by substituting a newline ('\n') into it. 1499 <p> 1500 A substitution is considered to have been performed even if the 1501 replacement string is identical to the string that it replaces. 1502 * <p> 1503 * Note that the method returns the command builder to allow for command 1504 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1505 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1506 * 1507 * @param regexp Regular expression matched against a line. 1508 * @param replacement Replacement string for substitute command. An ampersand ('&') 1509 appearing in the replacement string is replaced by the string 1510 matching the regular expression. The characters "\n", where n is a 1511 digit, are replaced by the text matched by the corresponding 1512 backreference expression. The special meaning of '&' and "\n" in 1513 this context can be suppressed by preceding it by a backslash. 1514 * @return the command builder to allow for method chaining. Method 1515 * chaining is used here to create command chains. Adding a command 1516 * to the chain usually means that the previous command <i>pipes</i> 1517 * its output to the added command (the pipe symbol in unix) 1518 */ 1519 public static Unix4jCommandBuilder sed(String regexp, String replacement) { 1520 return builder().sed(regexp, replacement); 1521 } 1522 /** 1523 * Substitutes the replacement string for instances of the regexp in 1524 the matched line. Only the given occurrences of the regexp found 1525 within the matched string are substituted. 1526 <p> 1527 An ampersand ('&') appearing in the replacement is be replaced 1528 by the line matching the regexp. The characters "\n", where n is a 1529 digit, are replaced by the text matched by the corresponding 1530 backreference expression. The special meaning of '&' and "\n" 1531 in this context can be suppressed by preceding it by a backslash. 1532<p> 1533 A line can be split by substituting a newline ('\n') into it. 1534 <p> 1535 A substitution is considered to have been performed even if the 1536 replacement string is identical to the string that it replaces. 1537 * <p> 1538 * Note that the method returns the command builder to allow for command 1539 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1540 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1541 * 1542 * @param regexp Regular expression matched against a line. 1543 * @param replacement Replacement string for substitute command. An ampersand ('&') 1544 appearing in the replacement string is replaced by the string 1545 matching the regular expression. The characters "\n", where n is a 1546 digit, are replaced by the text matched by the corresponding 1547 backreference expression. The special meaning of '&' and "\n" in 1548 this context can be suppressed by preceding it by a backslash. 1549 * @param occurrence Substitute for the given occurrences only of the regexp found within 1550 the matched string; the occurrence indices are one-based. If empty 1551 or omitted, all occurrences are substituted. 1552 <p> 1553 (This operand only applies to the substitute command and is ignored 1554 by all other commands). 1555 * @return the command builder to allow for method chaining. Method 1556 * chaining is used here to create command chains. Adding a command 1557 * to the chain usually means that the previous command <i>pipes</i> 1558 * its output to the added command (the pipe symbol in unix) 1559 */ 1560 public static Unix4jCommandBuilder sed(String regexp, String replacement, int... occurrence) { 1561 return builder().sed(regexp, replacement, occurrence); 1562 } 1563 /** 1564 * Executes the sed command specified by the given options or executes 1565 the print command p if no command option has been declared. 1566 * <p> 1567 * Note that the method returns the command builder to allow for command 1568 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1569 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1570 * 1571 * @param options Sed options and commands 1572 * @param regexp Regular expression matched against a line. 1573 * @return the command builder to allow for method chaining. Method 1574 * chaining is used here to create command chains. Adding a command 1575 * to the chain usually means that the previous command <i>pipes</i> 1576 * its output to the added command (the pipe symbol in unix) 1577 */ 1578 public static Unix4jCommandBuilder sed(SedOptions options, String regexp) { 1579 return builder().sed(options, regexp); 1580 } 1581 /** 1582 * Executes the sed command specified by the given options or executes 1583 the substitute command s if no command option has been declared. 1584 * <p> 1585 * Note that the method returns the command builder to allow for command 1586 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1587 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1588 * 1589 * @param options Sed options and commands 1590 * @param string1 Regular expression matched against a line for all commands except 1591 for command y where string1 contains the source characters for the 1592 translation. 1593 * @param string2 Replacement string for substitute command s; appended, inserted or 1594 changed text for a, i and c command; destination characters for 1595 translate command y; ignored by all other commands. 1596 <p> 1597 If string2 is a replacement string for the substitute command: an 1598 ampersand ('&') appearing in the replacement string is replaced 1599 by the string matching the regular expression; the characters "\n", 1600 where n is a digit, are replaced by the text matched by the 1601 corresponding backreference expression. The special meaning of 1602 '&' and "\n" in this context can be suppressed by preceding it 1603 by a backslash. 1604<p> 1605 (This operand only applies to the commands s, a, i, c and y and is 1606 ignored by all other commands). 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 sed(SedOptions options, String string1, String string2) { 1613 return builder().sed(options, string1, string2); 1614 } 1615 /** 1616 * Executes the sed command specified by the given options or executes 1617 the substitute command s if no command option has been declared. 1618 <p> 1619 The string1 operand usually contains the regular expression matched 1620 against a line for all commands except for command y where string1 1621 contains the source characters for the translation. 1622 <p> 1623 The string2 operand contains the replacement string for the 1624 substitute command s. It contains the appended, inserted or changed 1625 text for the commands a, i and c, respectively, and the destination 1626 characters for the translate command y. All other commands ignore 1627 the string2 operand. 1628 * <p> 1629 * Note that the method returns the command builder to allow for command 1630 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1631 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1632 * 1633 * @param options Sed options and commands 1634 * @param string1 Regular expression matched against a line for all commands except 1635 for command y where string1 contains the source characters for the 1636 translation. 1637 * @param string2 Replacement string for substitute command s; appended, inserted or 1638 changed text for a, i and c command; destination characters for 1639 translate command y; ignored by all other commands. 1640 <p> 1641 If string2 is a replacement string for the substitute command: an 1642 ampersand ('&') appearing in the replacement string is replaced 1643 by the string matching the regular expression; the characters "\n", 1644 where n is a digit, are replaced by the text matched by the 1645 corresponding backreference expression. The special meaning of 1646 '&' and "\n" in this context can be suppressed by preceding it 1647 by a backslash. 1648<p> 1649 (This operand only applies to the commands s, a, i, c and y and is 1650 ignored by all other commands). 1651 * @param occurrence Substitute for the given occurrences only of the regexp found within 1652 the matched string; the occurrence indices are one-based. If empty 1653 or omitted, all occurrences are substituted. 1654 <p> 1655 (This operand only applies to the substitute command and is ignored 1656 by all other commands). 1657 * @return the command builder to allow for method chaining. Method 1658 * chaining is used here to create command chains. Adding a command 1659 * to the chain usually means that the previous command <i>pipes</i> 1660 * its output to the added command (the pipe symbol in unix) 1661 */ 1662 public static Unix4jCommandBuilder sed(SedOptions options, String string1, String string2, int... occurrence) { 1663 return builder().sed(options, string1, string2, occurrence); 1664 } 1665 /** 1666 * Sort the lines of all the specified files together and writes the 1667 result to the standard output. 1668 <p> 1669 Options can be specified by acronym (with a leading dash "-") or by 1670 long name (with two leading dashes "--"). Operands other than the 1671 default "--paths" operand have to be prefixed with the operand 1672 name. 1673 <p> 1674 The sort algorithm used is guaranteed to be stable: lines considered 1675 equal will not be reordered as a result of the sort. If two lines 1676 originate from different input files, the index of the file in the 1677 input arguments list defines the ordering of the lines. 1678 * <p> 1679 * Note that the method returns the command builder to allow for command 1680 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1681 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1682 * 1683 * @param args String arguments defining the options and operands for the command. 1684 Options can be specified by acronym (with a leading dash "-") or by 1685 long name (with two leading dashes "--"). Operands other than the 1686 default "--paths" operand have to be prefixed with the operand 1687 name (e.g. "--comparator" for a subsequent comparator operand value). 1688 * @return the command builder to allow for method chaining. Method 1689 * chaining is used here to create command chains. Adding a command 1690 * to the chain usually means that the previous command <i>pipes</i> 1691 * its output to the added command (the pipe symbol in unix) 1692 */ 1693 public static Unix4jCommandBuilder sort(String... args) { 1694 return builder().sort(args); 1695 } 1696 /** 1697 * Sort the lines of all the specified files together and writes the 1698 result to the standard output. 1699 <p> 1700 Comparisons are based on the entire line without line ending. The 1701 collating sequence of the current locale is used to perform the 1702 comparisons. 1703 <p> 1704 The sort algorithm used is guaranteed to be stable: lines considered 1705 equal will not be reordered as a result of the sort. If two lines 1706 originate from different input files, the index of the file in the 1707 input arguments list defines the ordering of the lines. 1708 * <p> 1709 * Note that the method returns the command builder to allow for command 1710 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1711 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1712 * 1713 * @param files The files to be sorted or merged; relative paths are not resolved 1714 (use the string paths argument to enable relative path resolving 1715 based on the current working directory). 1716 * @return the command builder to allow for method chaining. Method 1717 * chaining is used here to create command chains. Adding a command 1718 * to the chain usually means that the previous command <i>pipes</i> 1719 * its output to the added command (the pipe symbol in unix) 1720 */ 1721 public static Unix4jCommandBuilder sort(java.io.File... files) { 1722 return builder().sort(files); 1723 } 1724 /** 1725 * Sort the lines of all the specified files together and writes the 1726 result to the standard output. 1727 <p> 1728 Line comparisons are based on the specified {@code comparator}. 1729 <p> 1730 The sort algorithm used is guaranteed to be stable: lines considered 1731 equal will not be reordered as a result of the sort. If two lines 1732 originate from different input files, the index of the file in the 1733 input arguments list defines the ordering of the lines. 1734 * <p> 1735 * Note that the method returns the command builder to allow for command 1736 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1737 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1738 * 1739 * @param comparator The comparator to use for the line comparisons. 1740 * @param files The files to be sorted or merged; relative paths are not resolved 1741 (use the string paths argument to enable relative path resolving 1742 based on the current working directory). 1743 * @return the command builder to allow for method chaining. Method 1744 * chaining is used here to create command chains. Adding a command 1745 * to the chain usually means that the previous command <i>pipes</i> 1746 * its output to the added command (the pipe symbol in unix) 1747 */ 1748 public static Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) { 1749 return builder().sort(comparator, files); 1750 } 1751 /** 1752 * Sort the lines of all the specified files together and writes the 1753 result to the standard output. 1754 <p> 1755 Line comparisons are based on the specified {@code comparator}. 1756 <p> 1757 The sort algorithm used is guaranteed to be stable: lines considered 1758 equal will not be reordered as a result of the sort. If two lines 1759 originate from different input files, the index of the file in the 1760 input arguments list defines the ordering of the lines. 1761 * <p> 1762 * Note that the method returns the command builder to allow for command 1763 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1764 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1765 * 1766 * @param comparator The comparator to use for the line comparisons. 1767 * @param paths Pathnames of the files to be sorted, merged, or checked; wildcards * 1768 and ? are supported; relative paths are resolved on the 1769 basis of the current working directory. 1770 * @return the command builder to allow for method chaining. Method 1771 * chaining is used here to create command chains. Adding a command 1772 * to the chain usually means that the previous command <i>pipes</i> 1773 * its output to the added command (the pipe symbol in unix) 1774 */ 1775 public static Unix4jCommandBuilder sort(java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) { 1776 return builder().sort(comparator, paths); 1777 } 1778 /** 1779 * Sorts, merges, or sequence checks the lines the lines of all the 1780 specified files together and writes the result to the standard 1781 output. 1782 <p> 1783 Comparisons are based on the entire line without line ending. The 1784 collating sequence of the current locale is used to perform the 1785 comparisons. 1786 <p> 1787 The sort algorithm used is guaranteed to be stable: lines considered 1788 equal will not be reordered as a result of the sort. If two lines 1789 originate from different input files, the index of the file in the 1790 input arguments list defines the ordering of the lines. 1791 * <p> 1792 * Note that the method returns the command builder to allow for command 1793 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1794 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1795 * 1796 * @param options The options for the sort command. 1797 * @param files The files to be sorted or merged; relative paths are not resolved 1798 (use the string paths argument to enable relative path resolving 1799 based on the current working directory). 1800 * @return the command builder to allow for method chaining. Method 1801 * chaining is used here to create command chains. Adding a command 1802 * to the chain usually means that the previous command <i>pipes</i> 1803 * its output to the added command (the pipe symbol in unix) 1804 */ 1805 public static Unix4jCommandBuilder sort(SortOptions options, java.io.File... files) { 1806 return builder().sort(options, files); 1807 } 1808 /** 1809 * Sorts, merges, or sequence checks the lines the lines of all the 1810 specified files together and writes the result to the standard 1811 output. 1812 <p> 1813 Comparisons are based on the entire line without line ending. The 1814 collating sequence of the current locale is used to perform the 1815 comparisons. 1816 <p> 1817 The sort algorithm used is guaranteed to be stable: lines considered 1818 equal will not be reordered as a result of the sort. If two lines 1819 originate from different input files, the index of the file in the 1820 input arguments list defines the ordering of the lines. 1821 * <p> 1822 * Note that the method returns the command builder to allow for command 1823 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1824 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1825 * 1826 * @param options The options for the sort command. 1827 * @param paths Pathnames of the files to be sorted, merged, or checked; wildcards * 1828 and ? are supported; relative paths are resolved on the 1829 basis of the current working directory. 1830 * @return the command builder to allow for method chaining. Method 1831 * chaining is used here to create command chains. Adding a command 1832 * to the chain usually means that the previous command <i>pipes</i> 1833 * its output to the added command (the pipe symbol in unix) 1834 */ 1835 public static Unix4jCommandBuilder sort(SortOptions options, String... paths) { 1836 return builder().sort(options, paths); 1837 } 1838 /** 1839 * Sorts, merges, or sequence checks the lines the lines of all the 1840 specified files together and writes the result to the standard 1841 output. 1842 <p> 1843 Line comparisons are based on the specified {@code comparator}. 1844 All comparison related options except for {@code --reverse} are 1845 ignored. 1846 <p> 1847 The sort algorithm used is guaranteed to be stable: lines considered 1848 equal will not be reordered as a result of the sort. If two lines 1849 originate from different input files, the index of the file in the 1850 input arguments list defines the ordering of the lines. 1851 * <p> 1852 * Note that the method returns the command builder to allow for command 1853 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1854 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1855 * 1856 * @param options The options for the sort command. 1857 * @param comparator The comparator to use for the line comparisons. 1858 * @param files The files to be sorted or merged; relative paths are not resolved 1859 (use the string paths argument to enable relative path resolving 1860 based on the current working directory). 1861 * @return the command builder to allow for method chaining. Method 1862 * chaining is used here to create command chains. Adding a command 1863 * to the chain usually means that the previous command <i>pipes</i> 1864 * its output to the added command (the pipe symbol in unix) 1865 */ 1866 public static Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, java.io.File... files) { 1867 return builder().sort(options, comparator, files); 1868 } 1869 /** 1870 * Sorts, merges, or sequence checks the lines the lines of all the 1871 specified files together and writes the result to the standard 1872 output. 1873 <p> 1874 Line comparisons are based on the specified {@code comparator}. 1875 All comparison related options except for {@code --reverse} are 1876 ignored. 1877 <p> 1878 The sort algorithm used is guaranteed to be stable: lines considered 1879 equal will not be reordered as a result of the sort. If two lines 1880 originate from different input files, the index of the file in the 1881 input arguments list defines the ordering of the lines. 1882 * <p> 1883 * Note that the method returns the command builder to allow for command 1884 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1885 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1886 * 1887 * @param options The options for the sort command. 1888 * @param comparator The comparator to use for the line comparisons. 1889 * @param paths Pathnames of the files to be sorted, merged, or checked; wildcards * 1890 and ? are supported; relative paths are resolved on the 1891 basis of the current working directory. 1892 * @return the command builder to allow for method chaining. Method 1893 * chaining is used here to create command chains. Adding a command 1894 * to the chain usually means that the previous command <i>pipes</i> 1895 * its output to the added command (the pipe symbol in unix) 1896 */ 1897 public static Unix4jCommandBuilder sort(SortOptions options, java.util.Comparator<? super org.unix4j.line.Line> comparator, String... paths) { 1898 return builder().sort(options, comparator, paths); 1899 } 1900 /** 1901 * Reads the last n lines from each of the files specified and writes 1902 them to the standard output. If more than a single file is 1903 specified, each file is preceded by a header consisting of the 1904 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1905 of the file. 1906<p> 1907 Options can be specified by acronym (with a leading dash "-") or by 1908 long name (with two leading dashes "--"). Operands other than the 1909 default "--paths" operand have to be prefixed with the operand 1910 name. 1911 * <p> 1912 * Note that the method returns the command builder to allow for command 1913 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1914 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1915 * 1916 * @param args String arguments defining the options and operands for the command. 1917 Options can be specified by acronym (with a leading dash "-") or by 1918 long name (with two leading dashes "--"). Operands other than the 1919 default "--paths" operand have to be prefixed with the operand 1920 name (e.g. "--count" for a subsequent count operand value). 1921 * @return the command builder to allow for method chaining. Method 1922 * chaining is used here to create command chains. Adding a command 1923 * to the chain usually means that the previous command <i>pipes</i> 1924 * its output to the added command (the pipe symbol in unix) 1925 */ 1926 public static Unix4jCommandBuilder tail(String... args) { 1927 return builder().tail(args); 1928 } 1929 /** 1930 * Reads the last 10 lines from each of the specified files and writes 1931 them to the standard output. If more than a single file is 1932 specified, each file is preceded by a header consisting of the 1933 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1934 of the file. 1935 * <p> 1936 * Note that the method returns the command builder to allow for command 1937 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1938 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1939 * 1940 * @param files The input files to be filtered; relative paths are not resolved (use 1941 the string paths argument to enable relative path resolving based on 1942 the current working directory). 1943 * @return the command builder to allow for method chaining. Method 1944 * chaining is used here to create command chains. Adding a command 1945 * to the chain usually means that the previous command <i>pipes</i> 1946 * its output to the added command (the pipe symbol in unix) 1947 */ 1948 public static Unix4jCommandBuilder tail(java.io.File... files) { 1949 return builder().tail(files); 1950 } 1951 /** 1952 * Reads the last {@code count} lines from each of the specified files 1953 and writes them to the standard output. If more than a single file 1954 is specified, each file is preceded by a header consisting of the 1955 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1956 of the file. 1957 * <p> 1958 * Note that the method returns the command builder to allow for command 1959 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1960 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1961 * 1962 * @param count The last {@code count} lines of each input file are 1963 copied to standard output, starting from 1 (characters instead of 1964 lines if the {@code -c} option is specified, and offset from start 1965 instead of end with {@code -s} option). Must be a non-negative 1966 integer or an exception is thrown. If {@code count} is greater than 1967 the number number of lines (characters) in the input, the 1968 application will not error and send the whole file to the output. 1969 * @param files The input files to be filtered; relative paths are not resolved (use 1970 the string paths argument to enable relative path resolving based on 1971 the current working directory). 1972 * @return the command builder to allow for method chaining. Method 1973 * chaining is used here to create command chains. Adding a command 1974 * to the chain usually means that the previous command <i>pipes</i> 1975 * its output to the added command (the pipe symbol in unix) 1976 */ 1977 public static Unix4jCommandBuilder tail(long count, java.io.File... files) { 1978 return builder().tail(count, files); 1979 } 1980 /** 1981 * Reads the last {@code count} lines from each of the specified files 1982 and writes them to the standard output. If more than a single file 1983 is specified, each file is preceded by a header consisting of the 1984 string {@code "==> XXX <=="} where {@code "XXX"} is the name 1985 of the file. 1986 * <p> 1987 * Note that the method returns the command builder to allow for command 1988 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 1989 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 1990 * 1991 * @param count The last {@code count} lines of each input file are 1992 copied to standard output, starting from 1 (characters instead of 1993 lines if the {@code -c} option is specified, and offset from start 1994 instead of end with {@code -s} option). Must be a non-negative 1995 integer or an exception is thrown. If {@code count} is greater than 1996 the number number of lines (characters) in the input, the 1997 application will not error and send the whole file to the output. 1998 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 1999 supported; relative paths are resolved on the basis of the current 2000 working directory. 2001 * @return the command builder to allow for method chaining. Method 2002 * chaining is used here to create command chains. Adding a command 2003 * to the chain usually means that the previous command <i>pipes</i> 2004 * its output to the added command (the pipe symbol in unix) 2005 */ 2006 public static Unix4jCommandBuilder tail(long count, String... paths) { 2007 return builder().tail(count, paths); 2008 } 2009 /** 2010 * Reads the last {@code count} lines or characters from each of the 2011 specified files and writes them to the standard output. If more than 2012 a single file is specified and the {@code -q} option is not 2013 specified, each file is preceded by a header consisting of the 2014 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2015 of the file. 2016 * <p> 2017 * Note that the method returns the command builder to allow for command 2018 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2019 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2020 * 2021 * @param options Options for the tail command. 2022 * @param count The last {@code count} lines of each input file are 2023 copied to standard output, starting from 1 (characters instead of 2024 lines if the {@code -c} option is specified, and offset from start 2025 instead of end with {@code -s} option). Must be a non-negative 2026 integer or an exception is thrown. If {@code count} is greater than 2027 the number number of lines (characters) in the input, the 2028 application will not error and send the whole file to the output. 2029 * @param files The input files to be filtered; relative paths are not resolved (use 2030 the string paths argument to enable relative path resolving based on 2031 the current working directory). 2032 * @return the command builder to allow for method chaining. Method 2033 * chaining is used here to create command chains. Adding a command 2034 * to the chain usually means that the previous command <i>pipes</i> 2035 * its output to the added command (the pipe symbol in unix) 2036 */ 2037 public static Unix4jCommandBuilder tail(TailOptions options, long count, java.io.File... files) { 2038 return builder().tail(options, count, files); 2039 } 2040 /** 2041 * Reads the last {@code count} lines or characters from each of the 2042 specified files and writes them to the standard output. If more than 2043 a single file is specified and the {@code -q} option is not 2044 specified, each file is preceded by a header consisting of the 2045 string {@code "==> XXX <=="} where {@code "XXX"} is the name 2046 of the file. 2047 * <p> 2048 * Note that the method returns the command builder to allow for command 2049 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2050 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2051 * 2052 * @param options Options for the tail command. 2053 * @param count The last {@code count} lines of each input file are 2054 copied to standard output, starting from 1 (characters instead of 2055 lines if the {@code -c} option is specified, and offset from start 2056 instead of end with {@code -s} option). Must be a non-negative 2057 integer or an exception is thrown. If {@code count} is greater than 2058 the number number of lines (characters) in the input, the 2059 application will not error and send the whole file to the output. 2060 * @param paths Pathnames of the input files to be filtered; wildcards * and ? are 2061 supported; relative paths are resolved on the basis of the current 2062 working directory. 2063 * @return the command builder to allow for method chaining. Method 2064 * chaining is used here to create command chains. Adding a command 2065 * to the chain usually means that the previous command <i>pipes</i> 2066 * its output to the added command (the pipe symbol in unix) 2067 */ 2068 public static Unix4jCommandBuilder tail(TailOptions options, long count, String... paths) { 2069 return builder().tail(options, count, paths); 2070 } 2071 /** 2072 * Reads from the specified input {@code file} and compares adjacent 2073 lines, writing one copy of each input line to the standard output. 2074 The second and succeeding copies of repeated adjacent input lines 2075 are not written to the output. 2076 <p> 2077 Note that repeated lines in the input are not detected if they are 2078 not adjacent (see --global or -g option); sorted input lines always 2079 result in unique output lines. 2080 * <p> 2081 * Note that the method returns the command builder to allow for command 2082 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2083 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2084 * 2085 * @param file The files or directories used as starting point for the listing; 2086 relative paths are not resolved (use the string path argument to 2087 enable relative path resolving based on the current working 2088 directory). 2089 * @return the command builder to allow for method chaining. Method 2090 * chaining is used here to create command chains. Adding a command 2091 * to the chain usually means that the previous command <i>pipes</i> 2092 * its output to the added command (the pipe symbol in unix) 2093 */ 2094 public static Unix4jCommandBuilder uniq(java.io.File file) { 2095 return builder().uniq(file); 2096 } 2097 /** 2098 * Reads the file specified by its {@code path} and compares adjacent 2099 lines, writing one copy of each input line to the standard output. 2100 The second and succeeding copies of repeated adjacent input lines 2101 are not written to the output. 2102 <p> 2103 Note that repeated lines in the input are not detected if they are 2104 not adjacent (see --global or -g option); sorted input lines always 2105 result in unique output lines. 2106 * <p> 2107 * Note that the method returns the command builder to allow for command 2108 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2109 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2110 * 2111 * @param path The files or directories used as starting point for the listing; 2112 wildcards * and ? are supported; relative paths are resolved on the 2113 basis of the current working directory. 2114 * @return the command builder to allow for method chaining. Method 2115 * chaining is used here to create command chains. Adding a command 2116 * to the chain usually means that the previous command <i>pipes</i> 2117 * its output to the added command (the pipe symbol in unix) 2118 */ 2119 public static Unix4jCommandBuilder uniq(String path) { 2120 return builder().uniq(path); 2121 } 2122 /** 2123 * Reads from the specified input {@code file} and compares adjacent 2124 lines, writing one copy of each input line to the standard output. 2125 The second and succeeding copies of repeated adjacent input lines 2126 are not written to the output. 2127 <p> 2128 Note that repeated non-adjacent lines in the input are only detected 2129 with the --global or -g option. In other words, unique output lines 2130 are guaranteed only if either (a) the --global or -g option is 2131 specified, or (b) the input lines are sorted. 2132 * <p> 2133 * Note that the method returns the command builder to allow for command 2134 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2135 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2136 * 2137 * @param options The options defining the uniqueness details for the output lines. 2138 * @param file The files or directories used as starting point for the listing; 2139 relative paths are not resolved (use the string path argument to 2140 enable relative path resolving based on the current working 2141 directory). 2142 * @return the command builder to allow for method chaining. Method 2143 * chaining is used here to create command chains. Adding a command 2144 * to the chain usually means that the previous command <i>pipes</i> 2145 * its output to the added command (the pipe symbol in unix) 2146 */ 2147 public static Unix4jCommandBuilder uniq(UniqOptions options, java.io.File file) { 2148 return builder().uniq(options, file); 2149 } 2150 /** 2151 * Reads the file specified by its {@code path} and compares adjacent 2152 lines, writing one copy of each input line to the standard output. 2153 The second and succeeding copies of repeated adjacent input lines 2154 are not written to the output. 2155 <p> 2156 Note that repeated non-adjacent lines in the input are only detected 2157 with the --global or -g option. In other words, unique output lines 2158 are guaranteed only if either (a) the --global or -g option is 2159 specified, or (b) the input lines are sorted. 2160 * <p> 2161 * Note that the method returns the command builder to allow for command 2162 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2163 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2164 * 2165 * @param options The options defining the uniqueness details for the output lines. 2166 * @param path The files or directories used as starting point for the listing; 2167 wildcards * and ? are supported; relative paths are resolved on the 2168 basis of the current working directory. 2169 * @return the command builder to allow for method chaining. Method 2170 * chaining is used here to create command chains. Adding a command 2171 * to the chain usually means that the previous command <i>pipes</i> 2172 * its output to the added command (the pipe symbol in unix) 2173 */ 2174 public static Unix4jCommandBuilder uniq(UniqOptions options, String path) { 2175 return builder().uniq(options, path); 2176 } 2177 /** 2178 * Executes a count of lines, words and chars contained in each input 2179 file and writes them to the standard output. If more than one input 2180 file is specified, a line of cumulative counts for all the files is 2181 displayed on a separate line after the output for the last file. 2182 * <p> 2183 * Note that the method returns the command builder to allow for command 2184 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2185 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2186 * 2187 * @param files The input files; relative paths are not resolved (use the string 2188 paths argument to enable relative path resolving based on the 2189 current working directory). 2190 * @return the command builder to allow for method chaining. Method 2191 * chaining is used here to create command chains. Adding a command 2192 * to the chain usually means that the previous command <i>pipes</i> 2193 * its output to the added command (the pipe symbol in unix) 2194 */ 2195 public static Unix4jCommandBuilder wc(java.io.File... files) { 2196 return builder().wc(files); 2197 } 2198 /** 2199 * Executes a one or more counts, depending on the given options, in 2200 each of the given input files and writes them to the standard 2201 output. If more than one input file is specified, a line of 2202 cumulative counts for all the files is displayed on a separate line 2203 after the output for the last file. 2204 * <p> 2205 * Note that the method returns the command builder to allow for command 2206 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2207 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2208 * 2209 * @param options The options defining command behavior. 2210 * @param files The input files; relative paths are not resolved (use the string 2211 paths argument to enable relative path resolving based on the 2212 current working directory). 2213 * @return the command builder to allow for method chaining. Method 2214 * chaining is used here to create command chains. Adding a command 2215 * to the chain usually means that the previous command <i>pipes</i> 2216 * its output to the added command (the pipe symbol in unix) 2217 */ 2218 public static Unix4jCommandBuilder wc(WcOptions options, java.io.File... files) { 2219 return builder().wc(options, files); 2220 } 2221 /** 2222 * Executes a one or more counts, depending on the given options, in 2223 each of the given input files and writes them to the standard 2224 output. If more than one input file is specified, a line of 2225 cumulative counts for all the files is displayed on a separate line 2226 after the output for the last file. 2227 * <p> 2228 * Note that the method returns the command builder to allow for command 2229 * chaining. The command itself is returned by the {@link Unix4jCommandBuilder#build() build()} method 2230 * of the returned builder (see {@link Unix4jCommandBuilder} for more information). 2231 * 2232 * @param options The options defining command behavior. 2233 * @param paths Pathnames of the input files; wildcards * and ? are supported; 2234 relative paths are resolved on the basis of the current working 2235 directory. 2236 * @return the command builder to allow for method chaining. Method 2237 * chaining is used here to create command chains. Adding a command 2238 * to the chain usually means that the previous command <i>pipes</i> 2239 * its output to the added command (the pipe symbol in unix) 2240 */ 2241 public static Unix4jCommandBuilder wc(WcOptions options, String[] paths) { 2242 return builder().wc(options, paths); 2243 } 2244 2245 // no instances 2246 private Unix4j() { 2247 super(); 2248 } 2249}