Package org.apache.flex.swf

Examples of org.apache.flex.swf.Header


     * @return true if successful, false if there is an error in the header.
     * @throws IOException
     */
    protected boolean readHeader() throws IOException
    {
        Header header = swf.getHeader();
        try
        {
            bitStream.setReadBoundary(8); // 4 x UI8 and 1 x UI32
            final char[] signature = new char[] {
                (char)bitStream.readUI8(),
                (char)bitStream.readUI8(),
                (char)bitStream.readUI8()};

            if (!header.isSignatureValid(signature))
            {
                problems.add(new SWFInvalidSignatureProblem(swfPath));
                return false;
            }
           
            header.setSignature(signature);
            header.setVersion((byte)bitStream.readUI8());
            header.setLength(bitStream.readUI32());

            if (header.getCompression() == Compression.LZMA)
            {
                bitStream.setReadBoundary(bitStream.getOffset() + 4);
                long compressedSize = bitStream.readUI32(); // read the 4 bytes compressedLen;    
                header.setCompressedLength(compressedSize);
            }

            bitStream.setCompress(header.getCompression());

            // Max length of a Rect is 17 bytes
            bitStream.setReadBoundary(bitStream.getOffset() + 17);
            header.setFrameSize(readRect());

            bitStream.setReadBoundary(bitStream.getOffset() + 4);
            header.setFrameRate(bitStream.readFIXED8());
            header.setFrameCount(bitStream.readUI16());
        }
        catch (RuntimeException e)
        {
            problems.add(new SWFUnexpectedEndOfFileProblem(swfPath));
            return false;
View Full Code Here

TOP

Related Classes of org.apache.flex.swf.Header

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.