Getopt.java revision 1269
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * language governing permissions and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * A simple implementation of the getopt(3c). It does just implement what I 0N/A * need ;-) Please note that I dislike the way GNU getopt allows mixing of 0N/A * options and arguments, so this version will stop processing options as soon 0N/A * as it encounters an argument. 0N/A * Creates a new instance of Getopt 0N/A * @param argv argument vector 0N/A * @param opts the list of allowed options 0N/A * Parse the command line options 0N/A * @throws ParseException if an illegal argument is passed 0N/A // End of command line options ;) 0N/A // does this option take an argument? 0N/A // next should be an argument 0N/A // Rest of this is the argument 0N/A // next argument vector contains the argument 0N/A * Get the next option in the options string. 0N/A * @return the next valid option, or -1 if all options are processed 0N/A * Reset the current pointer so we may traverse all the options again.. 0N/A * Get the argument to the current option 0N/A * @return the argument or null if none present (or allowed) 0N/A * Get the index of the first argument 0N/A * @return the index of the first argument in the original array