diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..cbbff6a 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..683b570 100644 --- a/README.md +++ b/README.md @@ -55,14 +55,16 @@ Your assignment is to use Built-In java classes to: ## 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)? - * Is it a **Class method** or an **object Instance method**, how do you know? - * What is its **return data-type**? + * What is the **access modifer** (e.g. public, private, protected)? The access modifer is HiddenSecretes. + * Is it a **Class method** or an **object Instance method**, how do you know? It is a class method as it is bound to + the class and not the object. + * What is its **return data-type**? Its return data type is a class object. * Does it require any **arguments** to call it, and if so, how many **parameters** and of what **data-type**? -* Scan line by line through the code and try to determine how it works? - * What is familiar to you? - * What is not familiar to you? - * Do the **for** loops make sense, and if so, tell me what you think they do? +* Scan line by line through the code and try to determine how it works? Yes, it requres path.of, path.get, and .toFile . + * What is familiar to you? The for loops are fimilair and the try catch function as well. + * What is not familiar to you? Paths and IO are not familair to me. + * Do the **for** loops make sense, and if so, tell me what you think they do? Yes, they say for() then do this if() + happens then do this until the loop stops. ## PART 4 - Turn in diff --git a/src/HiddenSecrets.java b/src/HiddenSecrets.java index 71067b3..b2c1191 100644 --- a/src/HiddenSecrets.java +++ b/src/HiddenSecrets.java @@ -3,18 +3,22 @@ import com.drew.metadata.Directory; import com.drew.metadata.Tag; import com.drew.imaging.ImageMetadataReader; -import java.io.File; + import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; - +import java.nio.file.Paths; +import java.nio.file.Path; +import java.util.Scanner; // PUT YOUR IMPORTS HERE public class HiddenSecrets { - public static void getHiddenSecrets(File file) { + private static Object PATHS; + + public static void getHiddenSecrets(Path file) { try { Metadata metadata = ImageMetadataReader.readMetadata( - new FileInputStream(file) + new FileInputStream(String.valueOf(file)) ); for (Directory directory : metadata.getDirectories()) { for (Tag tag : directory.getTags()) { @@ -34,13 +38,20 @@ public static void getHiddenSecrets(File file) { } catch (ImageProcessingException ipe) { System.out.println("Failed to process the image meta-data"); } - } - public static void main(String[] args) { - // Put your code to request a file path, - // 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 } + public static void main (String[]args){ + Scanner n = new Scanner(System.in); + + String l = n.nextLine(); + Path path = (Path) Paths.get(l); + System.out.println(path); + getHiddenSecrets(Path.of(l)); + // Put your code to request a file path, + // 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 + } } +// \ No newline at end of file