parent
5b7257719b
commit
939f2a0de3
@ -0,0 +1 @@
|
||||
*.class
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,26 @@
|
||||
package com.platform.test;
|
||||
|
||||
public class Brick {
|
||||
private String ip;
|
||||
private String path;
|
||||
|
||||
public Brick(String ip, String path) {
|
||||
super();
|
||||
this.ip = ip;
|
||||
this.path = path;
|
||||
}
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.platform.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
|
||||
public class FolderReader {
|
||||
|
||||
public static FolderNode reader(String path) {
|
||||
FolderNode folderNode = null;
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
List<FolderNode> childrens = new ArrayList<FolderNode>();
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
FolderNode children = reader(files[i].getAbsolutePath());
|
||||
if (children != null)
|
||||
childrens.add(children);
|
||||
}
|
||||
}
|
||||
folderNode = new FolderNode(file.getName(), file.getAbsolutePath(),
|
||||
childrens);
|
||||
}
|
||||
return folderNode;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
FolderReader folderReader = new FolderReader();
|
||||
FolderNode folderNode = folderReader.reader("D:/bootstrap");
|
||||
//folderReader.print(folderNode);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.platform.test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
|
||||
public class Volume {
|
||||
private String name;
|
||||
private long totalSize;
|
||||
private long usedSize;
|
||||
private List<Brick> bricks;
|
||||
private List<FolderNode> folderNode;
|
||||
|
||||
public Volume(String volume, long totalSize, long usedSize,
|
||||
List<Brick> bricks, List<FolderNode> folderNode) {
|
||||
super();
|
||||
this.name = volume;
|
||||
this.totalSize = totalSize;
|
||||
this.usedSize = usedSize;
|
||||
this.bricks = bricks;
|
||||
this.folderNode = folderNode;
|
||||
}
|
||||
|
||||
public String getVolume() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setVolume(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getTotalSize() {
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
public void setTotalSize(long totalSize) {
|
||||
this.totalSize = totalSize;
|
||||
}
|
||||
|
||||
public long getUsedSize() {
|
||||
return usedSize;
|
||||
}
|
||||
|
||||
public void setUsedSize(long usedSize) {
|
||||
this.usedSize = usedSize;
|
||||
}
|
||||
|
||||
public List<Brick> getBricks() {
|
||||
return bricks;
|
||||
}
|
||||
|
||||
public void setBricks(List<Brick> bricks) {
|
||||
this.bricks = bricks;
|
||||
}
|
||||
|
||||
public List<FolderNode> getFolderNode() {
|
||||
return folderNode;
|
||||
}
|
||||
|
||||
public void setFolderNode(List<FolderNode> folderNode) {
|
||||
this.folderNode = folderNode;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue