Revision: 5922 http://jnode.svn.sourceforge.net/jnode/?rev=5922&view=rev Author: galatnm Date: 2012-08-10 07:20:25 +0000 (Fri, 10 Aug 2012) Log Message: ----------- Add HFS+ file info and BSD info fields Extract out some more dates
Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/FileInfo.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusBSDInfo.java trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFile.java trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/FileInfo.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/FileInfo.java 2012-08-10 07:18:21 UTC (rev 5921) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/FileInfo.java 2012-08-10 07:20:25 UTC (rev 5922) @@ -17,9 +17,31 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.hfsplus; +import org.jnode.util.BigEndian; + public class FileInfo { + private int fileType; + private int fileCreator; + private int finderFlags; + public FileInfo(byte[] data, int offset) { + fileType = BigEndian.getInt32(data, offset); + fileCreator = BigEndian.getInt32(data, offset + 4); + finderFlags = BigEndian.getInt16(data, offset + 8); + } + + public int getFileType() { + return fileType; + } + + public int getFileCreator() { + return fileCreator; + } + + public int getFinderFlags() { + return finderFlags; + } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusBSDInfo.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusBSDInfo.java 2012-08-10 07:18:21 UTC (rev 5921) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusBSDInfo.java 2012-08-10 07:20:25 UTC (rev 5922) @@ -20,6 +20,46 @@ package org.jnode.fs.hfsplus; +import org.jnode.util.BigEndian; + public class HfsPlusBSDInfo { + private int ownerID; + private int groupID; + private int adminFlags; + private int ownerFlags; + private int fileMode; + private int special; + public HfsPlusBSDInfo(byte[] data, int offset) { + ownerID = BigEndian.getInt32(data, offset); + groupID = BigEndian.getInt32(data, offset + 4); + adminFlags = data[offset + 8]; + ownerFlags = data[offset + 9]; + fileMode = BigEndian.getInt16(data, offset + 10); + special = BigEndian.getInt32(data, offset + 12); + } + + public int getOwnerID() { + return ownerID; + } + + public int getGroupID() { + return groupID; + } + + public int getAdminFlags() { + return adminFlags; + } + + public int getOwnerFlags() { + return ownerFlags; + } + + public int getFileMode() { + return fileMode; + } + + public int getSpecial() { + return special; + } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFile.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFile.java 2012-08-10 07:18:21 UTC (rev 5921) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFile.java 2012-08-10 07:20:25 UTC (rev 5922) @@ -82,6 +82,10 @@ createDate = BigEndian.getInt32(data, 12); contentModDate = BigEndian.getInt32(data, 16); attrModDate = BigEndian.getInt32(data, 20); + accessDate = BigEndian.getInt32(data, 24); + backupDate = BigEndian.getInt32(data, 28); + permissions = new HfsPlusBSDInfo(data, 32); + userInfo = new FileInfo(data, 48); datas = new HfsPlusForkData(data, 88); resources = new HfsPlusForkData(data, 168); } @@ -145,8 +149,8 @@ return HfsUtils.getDate(contentModDate & 0xffffffffL, false) * 1000L; } - public int getAttrModDate() { - return attrModDate; + public long getAttrModDate() { + return HfsUtils.getDate(attrModDate & 0xffffffffL, false) * 1000L; } public HfsPlusForkData getDatas() { @@ -157,12 +161,12 @@ return resources; } - public int getAccessDate() { - return accessDate; + public long getAccessDate() { + return HfsUtils.getDate(accessDate & 0xffffffffL, false) * 1000L; } - public int getBackupDate() { - return backupDate; + public long getBackupDate() { + return HfsUtils.getDate(backupDate & 0xffffffffL, false) * 1000L; } public HfsPlusBSDInfo getPermissions() { Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java 2012-08-10 07:18:21 UTC (rev 5921) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java 2012-08-10 07:20:25 UTC (rev 5922) @@ -20,6 +20,7 @@ package org.jnode.fs.hfsplus.catalog; +import org.jnode.fs.hfsplus.HfsPlusBSDInfo; import org.jnode.fs.hfsplus.HfsUtils; import org.jnode.util.BigEndian; @@ -36,6 +37,9 @@ private int createDate; private int contentModDate; private int attrModDate; + private int accessDate; + private int backupDate; + private HfsPlusBSDInfo permissions; /** * @@ -50,6 +54,9 @@ createDate = BigEndian.getInt32(data, 12); contentModDate = BigEndian.getInt32(data, 16); attrModDate = BigEndian.getInt32(data, 20); + accessDate = BigEndian.getInt32(data, 24); + backupDate = BigEndian.getInt32(data, 28); + permissions = new HfsPlusBSDInfo(data, 32); } /** @@ -120,10 +127,22 @@ return HfsUtils.getDate(contentModDate & 0xffffffffL, false) * 1000L; } - public int getAttrModDate() { - return attrModDate; + public long getAttrModDate() { + return HfsUtils.getDate(attrModDate & 0xffffffffL, false) * 1000L; } + public long getAccessDate() { + return HfsUtils.getDate(accessDate & 0xffffffffL, false) * 1000L; + } + + public long getBackupDate() { + return HfsUtils.getDate(backupDate & 0xffffffffL, false) * 1000L; + } + + public HfsPlusBSDInfo getPermissions() { + return permissions; + } + public void setRecordType(int recordType) { this.recordType = recordType; } @@ -144,8 +163,8 @@ this.contentModDate = (int) HfsUtils.getDate(contentModDate / 1000L, true); } - public void setAttrModDate(int attrModDate) { - this.attrModDate = attrModDate; + public void setAttrModDate(long attrModDate) { + this.attrModDate = (int) HfsUtils.getDate(attrModDate / 1000L, true); } public void incrementValence(){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Jnode-svn-commits mailing list Jnode-svn-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits