Package javax.imageio.stream

Examples of javax.imageio.stream.ImageInputStream.reset()


        ImageInputStream stream = (ImageInputStream)input;
        byte[] b = new byte[8];
        stream.mark();
        stream.readFully(b);
        stream.reset();
       
        return (b[0] == (byte)137 &&
                b[1] == (byte)80 &&
                b[2] == (byte)78 &&
                b[3] == (byte)71 &&
View Full Code Here


        iis.mark();
        // If the first two bytes are a JPEG SOI marker, it's probably
        // a JPEG file.  If they aren't, it definitely isn't a JPEG file.
        int byte1 = iis.read();
        int byte2 = iis.read();
        iis.reset();
        if ((byte1 == 0xFF) && (byte2 == JPEG.SOI)) {
            return true;
        }
        return false;
    }
View Full Code Here

                if (stream != null) {
                    stream.mark();
                }
                canDecode = spi.canDecodeInput(input);
                if (stream != null) {
                    stream.reset();
                }
               
                return canDecode;
            } catch (IOException e) {
                return false;
View Full Code Here

    {
        if (source instanceof ImageInputStream) {
            ImageInputStream in = (ImageInputStream)source;
            in.mark();
            long sig = in.readLong();
            in.reset();
            return sig == SIGNATURE;
        }
        return false;
    }
View Full Code Here

        iis.mark();
        // If the first two bytes are a JPEG SOI marker, it's probably
        // a JPEG file.  If they aren't, it definitely isn't a JPEG file.
        int byte1 = iis.read();
        int byte2 = iis.read();
        iis.reset();
        if ((byte1 == 0xFF) && (byte2 == JPEG.SOI)) {
            return true;
        }
        return false;
    }
View Full Code Here

        int type = stream.readByte();   // TypeField
        int fixHeaderField = stream.readByte();
        // check WBMP "header"
        if (type != 0 || fixHeaderField != 0) {
            // while WBMP reader does not support ext WBMP headers
            stream.reset();
            return false;
        }

        int width = ReaderUtil.readMultiByteInteger(stream);
        int height = ReaderUtil.readMultiByteInteger(stream);
View Full Code Here

        int width = ReaderUtil.readMultiByteInteger(stream);
        int height = ReaderUtil.readMultiByteInteger(stream);
        // check image dimension
        if (width <= 0 || height <= 0) {
            stream.reset();
            return false;
        }

        long dataLength = stream.length();
        if (dataLength == -1) {
View Full Code Here

            // the length of the data stream.
            // Assuming that wbmp image are used for mobile devices,
            // let's introduce an upper limit for image dimension.
            // In case if exact amount of raster data is unknown,
            // let's reject images with dimension above the limit.
            stream.reset();
            return (width < MAX_WBMP_WIDTH) && (height < MAX_WBMP_HEIGHT);
        }

        dataLength -= stream.getStreamPosition();
        stream.reset();
View Full Code Here

            stream.reset();
            return (width < MAX_WBMP_WIDTH) && (height < MAX_WBMP_HEIGHT);
        }

        dataLength -= stream.getStreamPosition();
        stream.reset();

        long scanSize = (width / 8) + ((width % 8) == 0 ? 0 : 1);

        return (dataLength == scanSize * height);
    }
View Full Code Here

        ImageInputStream stream = (ImageInputStream)input;
        byte[] b = new byte[8];
        stream.mark();
        stream.readFully(b);
        stream.reset();

        return (b[0] == (byte)137 &&
                b[1] == (byte)80 &&
                b[2] == (byte)78 &&
                b[3] == (byte)71 &&
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.