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.

26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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!
Expand Down
Binary file added images/crmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/AccessToMetadata.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import com.drew.metadata.Metadata;
public class AccessToMetadata {
// Hello Mario
}
16 changes: 15 additions & 1 deletion src/HiddenSecrets.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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
}
}