Client reading .kaza description files

git-svn-id: svn://anubis/gvsu@43 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-03-08 23:13:18 +00:00
parent 0010b52177
commit 6b5cde51da

View File

@ -22,7 +22,27 @@ public class KaZaClient
m_socket.getOutputStream());
os.writeBytes("HELO " + userName + "\n");
os.writeBytes("SPED " + kbps + "\n");
// TODO: publish file list
File sharedDir = new File(m_sharedFolder);
if (sharedDir.isDirectory())
{
String[] files = sharedDir.list();
for (String fName : files)
{
if (fName.endsWith(".kaza"))
{
/* we found a description file, publish this file */
FileInputStream fis = new FileInputStream(m_sharedFolder +
File.separator +
fName);
BufferedReader br = new BufferedReader(
new InputStreamReader(fis));
String sharedFileName = br.readLine();
String sharedFileDesc = br.readLine();
os.writeBytes("DESC " + sharedFileName + "\n" +
sharedFileDesc + "\n");
}
}
}
} catch (Exception e) {
return;
}