use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.
the class WccAttr method serialize.
public void serialize(XDR out) {
out.writeLongAsHyper(size);
if (mtime == null) {
mtime = new NfsTime(0);
}
mtime.serialize(out);
if (ctime == null) {
ctime = new NfsTime(0);
}
ctime.serialize(out);
}
use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.
the class WccAttr method deserialize.
public static WccAttr deserialize(XDR xdr) {
long size = xdr.readHyper();
NfsTime mtime = NfsTime.deserialize(xdr);
NfsTime ctime = NfsTime.deserialize(xdr);
return new WccAttr(size, mtime, ctime);
}
use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.
the class SETATTR3Request method deserialize.
public static SETATTR3Request deserialize(XDR xdr) throws IOException {
FileHandle handle = readHandle(xdr);
SetAttr3 attr = new SetAttr3();
attr.deserialize(xdr);
boolean check = xdr.readBoolean();
NfsTime ctime;
if (check) {
ctime = NfsTime.deserialize(xdr);
} else {
ctime = null;
}
return new SETATTR3Request(handle, attr, check, ctime);
}
use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.
the class TestNfsTime method testConstructor.
@Test
public void testConstructor() {
NfsTime nfstime = new NfsTime(1001);
Assert.assertEquals(1, nfstime.getSeconds());
Assert.assertEquals(1000000, nfstime.getNseconds());
}
use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.
the class TestNfsTime method testSerializeDeserialize.
@Test
public void testSerializeDeserialize() {
// Serialize NfsTime
NfsTime t1 = new NfsTime(1001);
XDR xdr = new XDR();
t1.serialize(xdr);
// Deserialize it back
NfsTime t2 = NfsTime.deserialize(xdr.asReadOnlyWrap());
// Ensure the NfsTimes are equal
Assert.assertEquals(t1, t2);
}
Aggregations