Package fr.xlim.ssd.capmanipulator.library

Examples of fr.xlim.ssd.capmanipulator.library.DirectoryComponent


    private final static Logger logger = LoggerFactory.getLogger(DirectoryComponentRead.class);

    @Override
    public Component load(CapInputStream in) throws UnableToReadCapFileException {

        DirectoryComponent directoryComponent = new DirectoryComponent();

        // tag and size reading
        super.load((byte) ComponentEnum.DIRECTORY_COMPONENT.getValue(), in, directoryComponent);

        // we reset the count of byte read to zero
        in.resetCount();

        // number of bytes in each of the 12 components in the CAP file
        directoryComponent.setComponentSize(new ArrayList<Short>());
        directoryComponent.setStaticFieldSize(new StaticFieldSizeInfo());
        directoryComponent.setCustomComponent(new ArrayList<CustomComponentInfo>());

        // componentSizes reading
        for (int i = 0; i < DirectoryComponent.COMPONENT_NUMBER; i++) {
            short size = in.readShort();
            logger.trace("component number {} has size {}", i, size);
            directoryComponent.getComponentSize().add(size);
        }

        // staticFieldSize reading
        directoryComponent.setStaticFieldSize(new StaticFieldSizeInfoRead().load(in));

        // importCount reading
        directoryComponent.setImportCount(in.readByte());
        logger.trace("import count: {}", directoryComponent.getImportCount());

        // appletCount reading
        directoryComponent.setAppletCount(in.readByte());
        logger.trace("applet count: {}", directoryComponent.getAppletCount());

        // customCount reading
        directoryComponent.setCustomCount(in.readByte());
        logger.trace("custom count: {}", directoryComponent.getCustomCount());

        // customComponents reading
        for (byte i = 0; i < directoryComponent.getCustomCount(); i++) {
            CustomComponentInfo customComp = new CustomComponentInfoRead().load(in);
            directoryComponent.getCustomComponent().add(customComp);
        }

        checkSize(in, directoryComponent);

        return directoryComponent;
View Full Code Here


                capFile.getComponents().add(h);
                break;

            case DIRECTORY_COMPONENT:
                logger.debug(LogType.COMPONENT.getMarker(), "Found Directory Component");
                DirectoryComponent d = (DirectoryComponent) new DirectoryComponentRead().load(inputStream);
                capFile.getComponents().add(d);

                // we'll get the list of custom componentTab declared
                // in the directory componentTab
                for (int i = 0; i < d.getCustomCount(); i++) {
                    lCustomTag.add(d.getCustomComponent().get(i)
                            .getComponentTag());
                }
                break;

View Full Code Here

TOP

Related Classes of fr.xlim.ssd.capmanipulator.library.DirectoryComponent

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.