Package org.jnode.apps.vmware.disk.handler

Examples of org.jnode.apps.vmware.disk.handler.UnsupportedFormatException


        SparseExtentHeader header = new SparseExtentHeader();

        int magicNum = bb.getInt();
        LOG.debug("magicNum=" + Long.toHexString(magicNum));
        if (magicNum != MAGIC_NUMBER) {
            throw new UnsupportedFormatException("not the magic number");
        }

        int version = bb.getInt();
        if (version != VERSION) {
            throw new IOException("bad version number (found:" + version + ")");
        }

        int flags = bb.getInt();
        header.setValidNewLineDetectionTest((flags & 0x01) == 0x01); // bit 0
        header.setRedundantGrainTableWillBeUsed((flags & 0x02) == 0x02); // bit
                                                                            // 1

        header.setCapacity(bb.getLong());
        header.setGrainSize(bb.getLong());
        header.setDescriptorOffset(bb.getLong());
        header.setDescriptorSize(bb.getLong());

        LOG.debug("read: offset(NumGTEsPerGT)=" + bb.position());
        int nb = bb.getInt();
        if (nb != numGTEsPerGT) {
            throw new IOException("bad number of entries per grain table (found:" + nb + ")");
        }
        header.setNumGTEsPerGT(nb);

        header.setRgdOffset(bb.getLong());

        LOG.debug("read: offset(GdOffset)=" + bb.position());
        header.setGdOffset(bb.getLong());
        header.setOverHead(bb.getLong());
        header.setUncleanShutdown(bb.get() == TRUE);

        LOG.debug("read: offset(singleEndLineChar)=" + bb.position());
        byte b = bb.get();
        if (b != singleEndLineChar) {
            throw new IOException("file corrupted after a FTP (singleEndLineChar=" + b + ")");
        }
        b = bb.get();
        if (b != nonEndLineChar) {
            throw new IOException("file corrupted after a FTP (nonEndLineChar=" + b + ")");
        }
        b = bb.get();
        if (b != doubleEndLineChar1) {
            throw new IOException("file corrupted after a FTP (doubleEndLineChar1=" + b + ")");
        }
        b = bb.get();
        if (b != doubleEndLineChar2) {
            throw new IOException("file corrupted after a FTP (doubleEndLineChar2=" + b + ")");
        }

        if (bb.remaining() < PAD_SIZE) {
            throw new UnsupportedFormatException("bad pad size (size=" + bb.remaining() + ")");
        }

        // additional/computed attributes
        IOUtils.computeGrainTableCoverage(header);
View Full Code Here


        Header header = new Header();

        LOG.debug("trying to read VERSION");
        KeyValue keyValue = IOUtils.readValue(reader, null, VERSION, false);
        if (!"1".equals(keyValue.getValue())) {
            throw new UnsupportedFormatException("expected version 1 (found:" +
                    keyValue.getValue() + ")");
        }
        header.setVersion(keyValue.getValue());

        keyValue = IOUtils.readValue(reader, keyValue, CID, false);
View Full Code Here

                        e.getMessage());
            }
        }

        if (fileDescriptor == null) {
            throw new UnsupportedFormatException("format not supported for file " + file);
        }

        LOG.info("descriptor for " + file.getName() + " is " + fileDescriptor.getClass().getName());

        return fileDescriptor;
View Full Code Here

TOP

Related Classes of org.jnode.apps.vmware.disk.handler.UnsupportedFormatException

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.