/* * @(#)ListProjects.java * * This file is part of webCDwriter - Network CD Writing. * * Copyright (C) 2001 Jörg P. M. Haeger * * webCDwriter is free software. See CDcreator.java for details. * * Jörg Haeger, 15.05.2001 */ import java.io.*; import java.util.*; class ListProjects extends Command { String strs[] = new String[100]; int numOfFiles[] = new int[100]; int numOfKBytes[] = new int[100]; int numOfTracks[] = new int[100]; long times[] = new long[100]; int count = 0; Vector getInfo(int index) { Vector info = new Vector(5, 0); info.addElement(strs[index]); java.text.DateFormat df = java.text.DateFormat.getDateInstance(); info.addElement(df.format(new Date(times[index]))); info.addElement(new Integer(numOfFiles[index])); info.addElement(new Integer(numOfTracks[index])); info.addElement(new Integer(numOfKBytes[index])); return info; } int getNumOfFiles(int index) { return numOfFiles[index]; } int getNumOfKBytes(int index) { return numOfKBytes[index]; } int getNumOfTracks(int index) { return numOfTracks[index]; } String[] getStrings() { String strs2[] = new String[count]; for (int i = 0; i < count; i++) strs2[i] = strs[i]; return strs2; } void parseProjectInfo(String lineStr) throws IOException { StreamTokenizer tokenizer = new StreamTokenizer( new StringReader(lineStr)); if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) return; numOfFiles[count] = (int)tokenizer.nval; if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) return; numOfTracks[count] = (int)tokenizer.nval; if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) return; numOfKBytes[count] = (int)tokenizer.nval; if (tokenizer.nextToken() != StreamTokenizer.TT_NUMBER) return; times[count] = 1000 * (long)tokenizer.nval; } void processHint(String str) { if (count == strs.length) return; strs[count] = removeEscChars( str.substring(0, str.indexOf(" "))); numOfFiles[count] = 0; numOfTracks[count] = 0; numOfKBytes[count] = 0; try { parseProjectInfo(str.substring(str.indexOf(" "))); } catch (IOException e) {} count++; } public void run() { execCommand("listProjects"); super.run(); } }