Package org.jnode.fs.ntfs.attribute

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


                    } else {
                        log.debug("Looking up MFT entry for: " + entry.getFileReferenceNumber());
                        holdingRecord = getVolume().getMFT().getRecord(entry.getFileReferenceNumber());
                    }

                    NTFSAttribute attribute = holdingRecord.findStoredAttributeByID(entry.getAttributeID());
                    log.debug("Attribute: " + attribute);
                    return attribute;
                } catch (IOException e) {
                    throw new IllegalStateException("Error getting MFT or FileRecord for attribute in list, ref = 0x" +
                        Long.toHexString(entry.getFileReferenceNumber()), e);
View Full Code Here


            final int type = getUInt32AsInt(offset + 0x00);
            if (type == 0xFFFFFFFF) {
                // Normal end of list condition.
                return null;
            } else {
                NTFSAttribute attribute = NTFSAttribute.getAttribute(FileRecord.this, offset);
                log.debug("Attribute: " + attribute);
                int offsetToNextOffset = getUInt32AsInt(offset + 0x04);
                if (offsetToNextOffset <= 0) {
                    log.error("Non-positive offset, preventing infinite loop.  Data on disk may be corrupt.  "
                        + "referenceNumber = " + referenceNumber);
View Full Code Here

        }

        @Override
        public NTFSAttribute next() {
            while (attributes.hasNext()) {
                NTFSAttribute attr = attributes.next();
                if (matches(attr)) {
                    return attr;
                }
            }
            return null;
View Full Code Here

    @Override
    public long getLength() {
        FileRecord.AttributeIterator attributes =
            getFileRecord().findAttributesByTypeAndName(NTFSAttribute.Types.DATA, null);
        NTFSAttribute attribute = attributes.next();

        if (attribute == null && indexEntry != null) {
            // Fall back to the size stored in the index entry if the data attribute is not present (even possible??)
            return indexEntry.getRealFileSize();
        }
View Full Code Here

    @Override
    public byte[] getSlackSpace() throws IOException {
        FileRecord.AttributeIterator dataAttributes = getFileRecord().findAttributesByTypeAndName(
            NTFSAttribute.Types.DATA, null);
        NTFSAttribute attribute = dataAttributes.next();

        if (attribute == null || attribute.isResident()) {
            // If the data attribute is missing there is no slack space. If it is resident then another attribute might
            // immediately follow the data. So for now we'll ignore that case
            return new byte[0];
        }
View Full Code Here

    @Override
    public Map<String, FSFile> getStreams() {
        Set<String> streamNames = new LinkedHashSet<String>();

        FileRecord.AttributeIterator dataAttributes = getFileRecord().findAttributesByType(NTFSAttribute.Types.DATA);
        NTFSAttribute attribute = dataAttributes.next();

        while (attribute != null) {
            String attributeName = attribute.getAttributeName();

            // The unnamed data attribute is the main file data, so ignore it
            if (attributeName != null) {
                streamNames.add(attributeName);
            }
View Full Code Here

        NTFSEntry entry = (NTFSEntry) getRootEntry().getDirectory().getEntry("$Volume");
        if (entry == null) {
            return "";
        }

        NTFSAttribute attribute = entry.getFileRecord().findAttributeByType(NTFSAttribute.Types.VOLUME_NAME);

        if (attribute instanceof NTFSResidentAttribute) {
            NTFSResidentAttribute residentAttribute = (NTFSResidentAttribute) attribute;
            byte[] nameBuffer = new byte[residentAttribute.getAttributeLength()];
View Full Code Here

     * @return the file name attribute.
     */
    public FileNameAttribute getFileNameAttribute() {
        if (fileNameAttribute == null) {
            AttributeIterator iterator = findAttributesByType(NTFSAttribute.Types.FILE_NAME);
            NTFSAttribute attribute = iterator.next();

            // Search for a Win32 file name if possible
            while (attribute != null) {
                if (fileNameAttribute == null ||
                    fileNameAttribute.getNameSpace() != FileNameAttribute.NameSpace.WIN32) {
View Full Code Here

     * @param id the ID.
     * @return the attribute found, or {@code null} if not found.
     */
    private NTFSAttribute findStoredAttributeByID(int id) {
        AttributeIterator iter = getAllStoredAttributes();
        NTFSAttribute attr;
        while ((attr = iter.next()) != null) {
            if (attr.getAttributeID() == id) {
                return attr;
            }
        }
        return null;
    }
View Full Code Here

     * @return the attribute found, or {@code null} if not found.
     * @see NTFSAttribute.Types
     */
    public NTFSAttribute findStoredAttributeByType(int typeID) {
        AttributeIterator iter = getAllStoredAttributes();
        NTFSAttribute attr;
        while ((attr = iter.next()) != null) {
            if (attr.getAttributeType() == typeID) {
                return attr;
            }
        }
        return null;
    }
View Full Code Here

TOP

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

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.