diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..501ce09 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..f562741 100644 --- a/README.md +++ b/README.md @@ -51,18 +51,27 @@ Your assignment is to use Built-In java classes to: 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). + ![Screenshot(1)](images/Screenshot%20(1).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: * What is the **access modifer** (e.g. public, private, protected)? + The access modifier is public static. * Is it a **Class method** or an **object Instance method**, how do you know? + The Class method or object Instance method is getHiddenSecrets. The way I know is that it follows the void return type and is also highlighted much like the "main" method is. * What is its **return data-type**? + The return data-type is void. * Does it require any **arguments** to call it, and if so, how many **parameters** and of what **data-type**? + It does require arguments to call it, there are two parameters to call it and one is the File class type and file object type. * Scan line by line through the code and try to determine how it works? * What is familiar to you? + What looks familiar is the Class types and object types that are being created, like *Metadata metadata* and *Directory directory*. It's interesting to just hover over the Class and object types and have IntelliJ pop up little windows of information. Another familiar class type is the FileInputStream type and the other System.out.println for the different errors. * What is not familiar to you? + What's not familiar are the _try_, _catch_, and _for_ methods and what they do. I think I loosely understand that the *catch* and *throw* methods are somehow related because IntelliJ was talking about how it will "throw" out errors if the syntax or file types aren't correct. * Do the **for** loops make sense, and if so, tell me what you think they do? + Kind of but not really. Looking at it, it looks like it's looping for the directories and other information like tags for the image provided that's given by the Metadata Extractor. Then spits this into the System.out.format("[%s]-%s = %s%n" .... ) with the information converted to Strings. ## PART 4 - Turn in diff --git a/images/Screenshot (1).png b/images/Screenshot (1).png new file mode 100644 index 0000000..414c672 Binary files /dev/null and b/images/Screenshot (1).png differ diff --git a/src/HiddenSecrets.java b/src/HiddenSecrets.java index 71067b3..e26df39 100644 --- a/src/HiddenSecrets.java +++ b/src/HiddenSecrets.java @@ -9,7 +9,10 @@ import java.io.IOException; // PUT YOUR IMPORTS HERE - +import com.drew.metadata.Metadata; +import java.nio.file.Paths; +import java.util.Scanner; +import java.nio.file.Path; public class HiddenSecrets { public static void getHiddenSecrets(File file) { try { @@ -42,5 +45,11 @@ public static void main(String[] args) { // convert that string into A Path type using Paths class, // and call the getHiddenSecrets method to get the file's meta-data // HERE + Scanner s = new Scanner(System.in); + System.out.println("Give me a file to read: "); + String fpStr = s.nextLine(); + Path path = Paths.get(fpStr); + getHiddenSecrets(path.toFile()); + } }