Package org.jnode.fs.ntfs.attribute

Examples of org.jnode.fs.ntfs.attribute.NTFSAttribute$Types


                } else {
                    log.debug("Attributes in attribute list");
                    iter = new AttributeListAttributeIterator();
                }

                NTFSAttribute attr;
                while ((attr = iter.next()) != null) {
                    attributeList.add(attr);
                }
            } catch (Exception e) {
                log.error("Error getting attributes for entry: " + this, e);
View Full Code Here


     * @param name       the name of the attribute or {@code null} for no name.
     * @return the total size of the attribute.
     */
    public long getAttributeTotalSize(int attrTypeID, String name) {
        FileRecord.AttributeIterator attributes = findAttributesByTypeAndName(attrTypeID, name);
        NTFSAttribute attribute = attributes.next();

        if (attribute == null) {
            throw new IllegalStateException("Failed to find an attribute with type: " + attrTypeID + " and name: '" +
                name + "'");
        }

        long totalSize = 0;

        while (attribute != null) {
            if (attribute.isResident()) {
                totalSize += ((NTFSResidentAttribute) attribute).getAttributeLength();
            } else {
                totalSize += ((NTFSNonResidentAttribute) attribute).getAttributeActualSize();
            }

View Full Code Here

        if (len == 0) {
            return;
        }

        final AttributeIterator dataAttrs = findAttributesByTypeAndName(NTFSAttribute.Types.DATA, streamName);
        NTFSAttribute attr = dataAttrs.next();
        if (attr == null) {
            throw new IOException("Data attribute not found, file record = " + this);
        }

        if (attr.isResident()) {
            if (dataAttrs.next() != null) {
                throw new IOException("Resident attribute should be by itself, file record = " + this);
            }

            final NTFSResidentAttribute resData = (NTFSResidentAttribute) attr;
            final int attrLength = resData.getAttributeLength();
            if (attrLength < len) {
                throw new IOException("File data(" + attrLength + "b) is not large enough to read:" + len + "b");
            }
            resData.getData(resData.getAttributeOffset() + (int) fileOffset, dest, off, len);

            if (log.isDebugEnabled()) {
                log.debug("readData: read from resident data");
            }

            return;
        }

        // At this point we know that at least the first attribute is non-resident.

        // calculate start and end cluster
        final int clusterSize = getVolume().getClusterSize();
        final long startCluster = fileOffset / clusterSize;
        final long endCluster = (fileOffset + len - 1) / clusterSize;
        final int nrClusters = (int) (endCluster - startCluster + 1);
        final byte[] tmp = new byte[nrClusters * clusterSize];

        long clusterWithinNresData = startCluster;
        int readClusters = 0;
        do {
            if (attr.isResident()) {
                throw new IOException("Resident attribute should be by itself, file record = " + this);
            }

            final NTFSNonResidentAttribute nresData = (NTFSNonResidentAttribute) attr;

View Full Code Here

TOP

Related Classes of org.jnode.fs.ntfs.attribute.NTFSAttribute$Types

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.