diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..0f2fd36 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index 4d9f4d9..ef3575d 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,21 @@ Your assignment is to use Built-In java classes to: 1. Pass the file object as an argument to the given **getHiddenSecrets** method. 1. Run the program and type in the path for our sample image, and record the GPS coordinates in the output. ![Ollie the Otter Image](images/OllieTheOtter.jpg) - * HINT: the path can be relative to the project directory, maybe use the string in the example above :-) +- I'm unsure what you meant by record GPS input, the image I uploaded did not have any attached, maybe due to my screenshotting software or file extension. I'm not too familiar with exif data, but I believe it only works for JPEGs? I do about everything in PNG. +- Regardless, here's the extracted GPS data from OllieTheOtter.JPG +``` + [GPS] - GPS Latitude Ref = N + [GPS] - GPS Latitude = 40° 46' 37.46" + [GPS] - GPS Longitude Ref = W + [GPS] - GPS Longitude = -124° 8' 41.55" +``` + * HINT: the path can be relative to the project directory, maybe use the string in the example above :-) 1. Look up the latitude and longitude coordinates in any online map you can find via Google. 1. Screenshot the map and add it into the **images** folder of this project. 1. Last add image markdown below this line to load your map image (Hint: Example image Markdown is just a couple lines above this). +![CR Map Image](./images/crmap.png) + ## PART 3 - Code Scanning and Interpretation * Look at the getHiddenSecrets method and identify the following parts by editing this README.md and providing your answers: @@ -64,6 +74,20 @@ Your assignment is to use Built-In java classes to: * What is not familiar to you? * Do the **for** loops make sense, and if so, tell me what you think they do? +1. The access modifier for *getHiddenSecrets* is public. +2. I believe it is a class method, being static, and since we do not need to create an object to run it. This is something I am still not fully familiar with, and would like more clarification on. +3. The return type is void, no expected return value. +4. getHiddenSecrets requires one file-type input to function. + +- I believe I recognize the catch sequences from our Archimedes assignment, which I believe was a failsafe to exit a program when conditions are met +- I'm unfamiliar with "try" +- The nested for loops seem relatively understandable, I don't understand some of the arguments inside of them, but it looks as though it: +1. Attempts to parse a file in which to run a readMetadata method +2. Parses directory? I'm unsure how powerful this would be on its own without user input, and why you would need a loop for it. Does it scan several directories? +3. Parses tags and prints them in a formatted line for each tag recognized +4. Prints an error when an error is returned through System(?) +5. Kills program and prints an error when filename is not something on disk, when the file cannot be read to completion, or the file/metadata is corrupt + ## PART 4 - Turn in ### Same as the last 2 Weeks! diff --git a/images/crmap.png b/images/crmap.png new file mode 100644 index 0000000..0f08059 Binary files /dev/null and b/images/crmap.png differ diff --git a/src/AccessToMetadata.java b/src/AccessToMetadata.java new file mode 100644 index 0000000..c149310 --- /dev/null +++ b/src/AccessToMetadata.java @@ -0,0 +1,4 @@ +import com.drew.metadata.Metadata; +public class AccessToMetadata { + // Hello Mario +} diff --git a/src/HiddenSecrets.java b/src/HiddenSecrets.java index 71067b3..f0518cb 100644 --- a/src/HiddenSecrets.java +++ b/src/HiddenSecrets.java @@ -10,6 +10,10 @@ // PUT YOUR IMPORTS HERE +import java.nio.file.Paths; +import java.nio.file.Path; +import java.util.Scanner; + public class HiddenSecrets { public static void getHiddenSecrets(File file) { try { @@ -27,6 +31,7 @@ public static void getHiddenSecrets(File file) { } } } + System.out.println("\nLet's let this be our little secret, okay?"); } catch (FileNotFoundException fnfe) { System.out.println("That file does not exist."); } catch (IOException ioe) { @@ -41,6 +46,15 @@ public static void main(String[] args) { // read in a string from System.in, // convert that string into A Path type using Paths class, // and call the getHiddenSecrets method to get the file's meta-data - // HERE + + Scanner scan = new Scanner(System.in); // Create new Scanner named Scan + + System.out.print("Please enter the name and extension of your desired image: "); + String scanInput = scan.nextLine(); // Request input and store in new String scanInput + System.out.println("Attempting to parse metadata on " + scanInput); + + String concatInput = "./images/" + scanInput; // Add and concatenate images directory to simplify image request + Path inputPath = Paths.get(concatInput); // Translate input string into a parsable path named inputPath + getHiddenSecrets(inputPath.toFile()); // Call getHiddenSecrets method on concatPath pointing to desired filename } }