public static void main(String[] args) throws Exception {

		boolean valid = true;
		boolean requiredArguments = false;

		String imageFormat = null;
		boolean rawImage = false;
		File inputDirectory = null;
		TileFormatType tileType = null;
		File geoPackageFile = null;
		String tileTable = null;

		for (int i = 0; valid && i < args.length; i++) {

			String arg = args[i];

			// Handle optional arguments
			if (arg.startsWith(ARGUMENT_PREFIX)) {

				String argument = arg.substring(ARGUMENT_PREFIX.length());

				switch (argument) {

				case ARGUMENT_IMAGE_FORMAT:
					if (i < args.length) {
						imageFormat = args[++i];
					} else {
						valid = false;
						System.out.println("Error: Image Format argument '"
								+ arg + "' must be followed by a image format");
					}
					break;

				case ARGUMENT_RAW_IMAGE:
					rawImage = true;
					break;

				default:
					valid = false;
					System.out.println("Error: Unsupported arg: '" + arg + "'");
				}

			} else {
				// Set required arguments in order
				if (inputDirectory == null) {
					inputDirectory = new File(arg);
				} else if (tileType == null) {
					tileType = TileFormatType.valueOf(arg.toUpperCase());
				} else if (geoPackageFile == null) {
					geoPackageFile = new File(arg);
				} else if (tileTable == null) {
					tileTable = arg;
					requiredArguments = true;
				} else {
					valid = false;
					System.out.println("Error: Unsupported extra argument: "
							+ arg);
				}
			}
		}

		if (!valid || !requiredArguments) {
			printUsage();
		} else {
			// Read the tiles
			try {
				readTiles(geoPackageFile, tileTable, inputDirectory,
						imageFormat, tileType, rawImage);
			} catch (Exception e) {
				printUsage();
				throw e;
			}
		}

	}
public static void main ( String [ ] args ) throws Exception { boolean valid = true ; boolean requiredArguments = false ; String imageFormat = null ; boolean rawImage = false ; File inputDirectory = null ; TileFormatType tileType = null ; File geoPackageFile = null ; String tileTable = null ; for ( int i = 0 ; valid && i < args . length ; i ++ ) { String arg = args [ i ] ; if ( arg . startsWith ( ARGUMENT_PREFIX ) ) { String argument = arg . substring ( ARGUMENT_PREFIX . length ( ) ) ; switch ( argument ) { case ARGUMENT_IMAGE_FORMAT : if ( i < args . length ) { imageFormat = args [ ++ i ] ; } else { valid = false ; System . out . println ( "Error: Image Format argument '" + arg + "' must be followed by a image format" ) ; } break ; case ARGUMENT_RAW_IMAGE : rawImage = true ; break ; default : valid = false ; System . out . println ( "Error: Unsupported arg: '" + arg + "'" ) ; } } else { if ( inputDirectory == null ) { inputDirectory = new File ( arg ) ; } else if ( tileType == null ) { tileType = TileFormatType . valueOf ( arg . toUpperCase ( ) ) ; } else if ( geoPackageFile == null ) { geoPackageFile = new File ( arg ) ; } else if ( tileTable == null ) { tileTable = arg ; requiredArguments = true ; } else { valid = false ; System . out . println ( "Error: Unsupported extra argument: " + arg ) ; } } } if ( ! valid || ! requiredArguments ) { printUsage ( ) ; } else { try { readTiles ( geoPackageFile , tileTable , inputDirectory , imageFormat , tileType , rawImage ) ; } catch ( Exception e ) { printUsage ( ) ; throw e ; } } }
Main method to read tiles from the file system into a GeoPackage

@param args
arguments
@throws Exception
upon failure