1 2 3 package net.nutch.ndfs; 4 5 import net.nutch.io.*; 6 import net.nutch.util.*; 7 8 import java.io.*; 9 import java.util.*; 10 11 17 public class NDFSFileInfo implements Writable { 18 UTF8 path; 19 long len; 20 long contentsLen; 21 boolean isDir; 22 23 25 public NDFSFileInfo() { 26 } 27 28 30 public NDFSFileInfo(UTF8 path, long len, long contentsLen, boolean isDir) { 31 this.path = path; 32 this.len = len; 33 this.contentsLen = contentsLen; 34 this.isDir = isDir; 35 } 36 37 39 public String getPath() { 40 return new File(path.toString()).getPath(); 41 } 42 43 45 public String getName() { 46 return new File(path.toString()).getName(); 47 } 48 49 51 public String getParent() { 52 return new File(path.toString()).getParent(); 53 } 54 55 57 public long getLen() { 58 return len; 59 } 60 61 63 public long getContentsLen() { 64 return contentsLen; 65 } 66 67 69 public boolean isDir() { 70 return isDir; 71 } 72 73 public void write(DataOutput out) throws IOException { 77 path.write(out); 78 out.writeLong(len); 79 out.writeLong(contentsLen); 80 out.writeBoolean(isDir); 81 } 82 83 public void readFields(DataInput in) throws IOException { 84 this.path = new UTF8(); 85 this.path.readFields(in); 86 this.len = in.readLong(); 87 this.contentsLen = in.readLong(); 88 this.isDir = in.readBoolean(); 89 } 90 } 91 92 | Popular Tags |