Skip to content
Snippets Groups Projects
Commit 969fb93d authored by Stefan Rosenlund's avatar Stefan Rosenlund
Browse files

Added some documentation

parent b8d18a2a
No related branches found
No related tags found
1 merge request!1feature/server and client update
......@@ -135,19 +135,26 @@ public class Server{
}
}
/**
* @return String with filenames of current directory and subdirectories
*/
public String list(){
String directory="";
try (Stream<Path> walk = Files.walk(Paths.get("."))) {
// regular file: https://unix.stackexchange.com/questions/99276/what-is-a-regular-file
directory = walk.filter(Files::isRegularFile)
.map(x -> x.toString())
.reduce("", (x,y)->x+y);
.reduce("", (x,y)->x+"/n"+y);
}catch(IOException e){
System.err.println("Error during walk through directory!");
}
return directory;
}
/**
* @param path path of the file requested
* @return byte array with file content
*/
public byte[] getFileContent(String path){
byte[] fileContent = new byte[1];
try{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment