Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
33 changes: 22 additions & 11 deletions src/HiddenSecrets.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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
}
}
//