-----<a target="blank">Java培训、Android培训、iOS培训、.Net培训</a>、期待与您交流! ------
package com.itheima;
文件:
package com.filesystem.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class File implements Serializable {
/**
*
*/
private static final long serialVersionUID = -7794633568512323923L;
private String fileName;
private String fileName_parent;
private List<Node> list_node = new ArrayList<Node>();
private int status=0;
private int length=0;
public File(){}
public File(String fileName,String fileName_parent)
{
this.fileName = fileName;
this.fileName_parent = fileName_parent;
this.status = 0;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileName_parent() {
return fileName_parent;
}
public void setFileName_parent(String fileName_parent) {
this.fileName_parent = fileName_parent;
}
public int getLength() {
Iterator<Node> it_node = this.list_node.iterator();
int sum =0;
while(it_node.hasNext())
{
Node node = it_node.next();
sum=sum+node.getLength();
}
return sum;
}
public void setLength(int length) {
this.length = length;
}
public List<Node> getList_node() {
return list_node;
}
public void setList_node(List<Node> list_node) {
this.list_node = list_node;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
用户:
package com.filesystem.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class User implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6480732888217615700L;
private String name;
private String password;
private List<File> list_file=new ArrayList<File>();
public User(){}
public User(String name,String password)
{
this.name = name;
this.password=password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<File> getList_file() {
return list_file;
}
public void setList_file(List<File> list_file) {
this.list_file = list_file;
}
}
磁盘:
package com.filesystem.beans;
import java.io.Serializable;
public class DiskContain implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6981176984792509942L;
private char[] diskcontain = new char[1024];
public DiskContain()
{
for(int i = 0;i<diskcontain.length;i++)
{
diskcontain[i]='@';
}
}
public char[] getDiskcontain() {
return diskcontain;
}
public void setDiskcontain(char[] diskcontain) {
this.diskcontain = diskcontain;
}
}
存储:
package com.filesystem.beans;
import java.io.Serializable;
public class Node implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3728455469174736095L;
private int startPosition;
private int length;
private int endPosition;
public Node()
{
}
public Node(int startPosition,int length,int endPosition)
{
this.startPosition = startPosition;
this.length = length;
this.endPosition= endPosition;
}
public int getStartPosition() {
return startPosition;
}
public void setStartPosition(int startPosition) {
this.startPosition = startPosition;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public int getEndPosition() {
return endPosition;
}
public void setEndPosition(int endPosition) {
this.endPosition = endPosition;
}
}
这应该是什么存储方式?随机存储还是连续存储? |
|