greetings to all,
I am attempting to access a mp3 folder on my c drive. however I am recieving an IO exception stating that the file cannot be accessed. I have researched similar issues but cannot find a salution to my own one. what could i be doing wrong? heres my class:
would greatly appreciate any replies
//import java io and utilties packages //GO OVER CONSTRUCTOR METHODS import java.io.*; import java.util.*; //mp3 folder class class FolderMP3s { //constructor to set up objects FolderMP3s() { try { //file object File folder = new File("C:\\Users\\namso1902\\Cool Devices"); //input and output stream objects FileInputStream inStream = new FileInputStream(folder); //file array File[] songs = new File[3]; songs = folder.listFiles(); //skip everything except last 128 bytes int size; //array to hold 128 bytes and in string format byte[] last128 = new byte[128]; String id3; String tag; //skip through each file for (int i = 0; i < 3; i++) { size = (int) songs[i].length(); inStream.skip(size - 128); inStream.read(last128); id3 = new String(last128); tag = id3.substring(0, 3); //check tag of each file in folder //change titles if (tag.equals("TAG")) { System.out.println("tag: " + tag); } } } //IOException is superclass of all IO exceptions catch (IOException ioe) { //display exception message System.out.println("File error details: " + ioe.getMessage()); } } //main method public static void main(String[] arguements) { FolderMP3s mp3s = new FolderMP3s(); } }