Package javax.imageio.stream

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


                    in.mark();
                    try {
                        reclen = jpeg.readSegmentLength();
                        // Check for Adobe header
                        byte[] adobeHeader = new byte[5];
                        in.readFully(adobeHeader);

                        if ("Adobe".equals(new String(adobeHeader, "US-ASCII"))) {
                            // The reason for reading the APPE marker is that Adobe Photoshop
                            // generates CMYK JPEGs with inverted values. The correct thing
                            // to do would be to interpret the values in the marker, but for now
View Full Code Here


                        break;
                    }
                    case 14: {
                        final int length = random.nextInt(ARRAY_MAX_SIZE);
                        final byte[] expected = new byte[length]; r.readFully(expected);
                        final byte[] actual   = new byte[length]; t.readFully(actual);
                        assertArrayEquals("readFully(byte[])", expected, actual);
                        break;
                    }
                    case 15: {
                        final int length = random.nextInt(ARRAY_MAX_SIZE * Byte.SIZE / Character.SIZE);
View Full Code Here

                        break;
                    }
                    case 15: {
                        final int length = random.nextInt(ARRAY_MAX_SIZE * Byte.SIZE / Character.SIZE);
                        final char[] expected = new char[length]; r.readFully(expected, 0, length);
                        final char[] actual   = new char[length]; t.readFully(actual,   0, length);
                        assertArrayEquals("readFully(char[])", expected, actual);
                        break;
                    }
                    case 16: {
                        final int length = random.nextInt(ARRAY_MAX_SIZE * Byte.SIZE / Short.SIZE);
View Full Code Here

                        break;
                    }
                    case 16: {
                        final int length = random.nextInt(ARRAY_MAX_SIZE * Byte.SIZE / Short.SIZE);
                        final short[] expected = new short[length]; r.readFully(expected, 0, length);
                        final short[] actual   = new short[length]; t.readFully(actual,   0, length);
                        assertArrayEquals("readFully(short[])", expected, actual);
                        break;
                    }
                    case 17: {
                        final int length = random.nextInt(ARRAY_MAX_SIZE * Byte.SIZE / Integer.SIZE);
View Full Code Here

        }

        ImageInputStream stream = (ImageInputStream)source;
        byte[] b = new byte[2];
        stream.mark();
        stream.readFully(b);
        stream.reset();

        return (b[0] == 0x42) && (b[1] == 0x4d);
    }
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 &&
View Full Code Here

                    if (pos + scanlineStride > length) {
                        iis.reset();
                        iis.mark();
                        pos = 0;
                    }
                    iis.readFully(buf);
                    pos += scanlineStride;
                } while (--numReps >= 0);
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
View Full Code Here

                    in.mark();
                    try {
                        reclen = jpeg.readSegmentLength();
                        // Check for ICC profile
                        byte[] iccString = new byte[11];
                        in.readFully(iccString);
                        in.skipBytes(1); //string terminator (null byte)

                        if ("ICC_PROFILE".equals(new String(iccString, "US-ASCII"))) {
                            in.skipBytes(2); //chunk sequence number and total number of chunks
                            int payloadSize = reclen - 2 - 12 - 2;
View Full Code Here

                            if (ignoreColorProfile(hints)) {
                                log.debug("Ignoring ICC profile data in JPEG");
                                in.skipBytes(payloadSize);
                            } else {
                                byte[] buf = new byte[payloadSize];
                                in.readFully(buf);
                                if (iccStream == null) {
                                    if (log.isDebugEnabled()) {
                                        log.debug("JPEG has an ICC profile");
                                        DataInputStream din = new DataInputStream(new ByteArrayInputStream(buf));
                                        log.debug("Declared ICC profile size: " + din.readInt());
View Full Code Here

                    in.mark();
                    try {
                        reclen = jpeg.readSegmentLength();
                        // Check for Adobe header
                        byte[] adobeHeader = new byte[5];
                        in.readFully(adobeHeader);
                       
                        if ("Adobe".equals(new String(adobeHeader, "US-ASCII"))) {
                            // The reason for reading the APPE marker is that Adobe Photoshop
                            // generates CMYK JPEGs with inverted values. The correct thing
                            // to do would be to interpret the values in the marker, but for now
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.