Examples of CachingInputStream


Examples of com.volantis.shared.io.CachingInputStream

        return cached.getContentStyle();
    }

    public InputStream getInputStream() throws IOException {
        if (cachingInputStream == null) {
            cachingInputStream = new CachingInputStream(cached.getInputStream());
        }
        return cachingInputStream;
    }
View Full Code Here

Examples of com.volantis.shared.io.CachingInputStream

        if (stepType.isFirst()) {
            if (logger.isDebugEnabled()) {
                // dump the input to the first step for debugging
                logger.debug("Input to migrator");
                CachingInputStream is = new CachingInputStream(input);
                dumpStream(is);
                input = is.getCacheInputStream();
            }
        } else {
            // disable input validation on all steps except the first
            inputReaderFactory.disableValidation();
        }
View Full Code Here

Examples of org.apache.sanselan.util.CachingInputStream

        return null;
    }

    private IccProfileInfo readICCProfileInfo(InputStream is)
    {
        CachingInputStream cis = new CachingInputStream(is);
        is = cis;

        if (debug)
            Debug.debug();

        //                setDebug(true);

        //        if (debug)
        //            Debug.debug("length: " + length);

        try
        {
            int ProfileSize = read4Bytes("ProfileSize", is,
                    "Not a Valid ICC Profile");

            //            if (length != ProfileSize)
            //            {
            //                //                Debug.debug("Unexpected Length data expected: " + Integer.toHexString((int) length)
            //                //                        + ", encoded: " + Integer.toHexString(ProfileSize));
            //                //                Debug.debug("Unexpected Length data: " + length
            //                //                        + ", length: " + ProfileSize);
            //                //                throw new Error("asd");
            //                return null;
            //            }

            int CMMTypeSignature = read4Bytes("Signature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("CMMTypeSignature", CMMTypeSignature);

            int ProfileVersion = read4Bytes("ProfileVersion", is,
                    "Not a Valid ICC Profile");

            int ProfileDeviceClassSignature = read4Bytes(
                    "ProfileDeviceClassSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileDeviceClassSignature",
                        ProfileDeviceClassSignature);

            int ColorSpace = read4Bytes("ColorSpace", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ColorSpace", ColorSpace);

            int ProfileConnectionSpace = read4Bytes("ProfileConnectionSpace",
                    is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileConnectionSpace", ProfileConnectionSpace);

            skipBytes(is, 12, "Not a Valid ICC Profile");

            int ProfileFileSignature = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileFileSignature", ProfileFileSignature);

            int PrimaryPlatformSignature = read4Bytes(
                    "PrimaryPlatformSignature", is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("PrimaryPlatformSignature",
                        PrimaryPlatformSignature);

            int VariousFlags = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileFileSignature", ProfileFileSignature);

            int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("DeviceManufacturer", DeviceManufacturer);

            int DeviceModel = read4Bytes("DeviceModel", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("DeviceModel", DeviceModel);

            skipBytes(is, 8, "Not a Valid ICC Profile");

            int RenderingIntent = read4Bytes("RenderingIntent", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("RenderingIntent", RenderingIntent);

            skipBytes(is, 12, "Not a Valid ICC Profile");

            int ProfileCreatorSignature = read4Bytes("ProfileCreatorSignature",
                    is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileCreatorSignature",
                        ProfileCreatorSignature);

            byte ProfileID[] = null;
            skipBytes(is, 16, "Not a Valid ICC Profile");
            //            readByteArray("ProfileID", 16, is,
            //                    "Not a Valid ICC Profile");
            //            if (debug)
            //                System.out
            //                        .println("ProfileID: '" + new String(ProfileID) + "'");

            skipBytes(is, 28, "Not a Valid ICC Profile");

            //            this.setDebug(true);

            int TagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");

            //            ArrayList tags = new ArrayList();
            IccTag tags[] = new IccTag[TagCount];

            for (int i = 0; i < TagCount; i++)
            {
                int TagSignature = read4Bytes("TagSignature[" + i + "]", is,
                        "Not a Valid ICC Profile");
                //                Debug.debug("TagSignature t "
                //                        + Integer.toHexString(TagSignature));

                //                this.printCharQuad("TagSignature", TagSignature);
                int OffsetToData = read4Bytes("OffsetToData[" + i + "]", is,
                        "Not a Valid ICC Profile");
                int ElementSize = read4Bytes("ElementSize[" + i + "]", is,
                        "Not a Valid ICC Profile");

                IccTagType fIccTagType = getIccTagType(TagSignature);
                //                if (fIccTagType == null)
                //                    throw new Error("oops.");

                //                System.out
                //                        .println("\t["
                //                                + i
                //                                + "]: "
                //                                + ((fIccTagType == null)
                //                                        ? "unknown"
                //                                        : fIccTagType.name));
                //                Debug.debug();

                IccTag tag = new IccTag(TagSignature, OffsetToData,
                        ElementSize, fIccTagType);
                //                tag.dump("\t" + i + ": ");
                tags[i] = tag;
                //                tags .add(tag);
            }

            {
                // read stream to end, filling cache.
                while (is.read() >= 0)
                    ;
            }

            byte data[] = cis.getCache();

            if (data.length < ProfileSize)
                throw new IOException("Couldn't read ICC Profile.");

            IccProfileInfo result = new IccProfileInfo(data, ProfileSize,
View Full Code Here

Examples of org.apache.sanselan.util.CachingInputStream

    return null;
  }

  private IccProfileInfo readICCProfileInfo(InputStream is)
  {
    CachingInputStream cis = new CachingInputStream(is);
    is = cis;

    if (debug)
      Debug.debug();

    //        setDebug(true);

    //    if (debug)
    //      Debug.debug("length: " + length);

    try
    {
      int ProfileSize = read4Bytes("ProfileSize", is,
          "Not a Valid ICC Profile");

      //      if (length != ProfileSize)
      //      {
      //        //        Debug.debug("Unexpected Length data expected: " + Integer.toHexString((int) length)
      //        //            + ", encoded: " + Integer.toHexString(ProfileSize));
      //        //        Debug.debug("Unexpected Length data: " + length
      //        //            + ", length: " + ProfileSize);
      //        //        throw new Error("asd");
      //        return null;
      //      }

      int CMMTypeSignature = read4Bytes("Signature", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("CMMTypeSignature", CMMTypeSignature);

      int ProfileVersion = read4Bytes("ProfileVersion", is,
          "Not a Valid ICC Profile");

      int ProfileDeviceClassSignature = read4Bytes(
          "ProfileDeviceClassSignature", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("ProfileDeviceClassSignature",
            ProfileDeviceClassSignature);

      int ColorSpace = read4Bytes("ColorSpace", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("ColorSpace", ColorSpace);

      int ProfileConnectionSpace = read4Bytes("ProfileConnectionSpace",
          is, "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("ProfileConnectionSpace", ProfileConnectionSpace);

      skipBytes(is, 12, "Not a Valid ICC Profile");

      int ProfileFileSignature = read4Bytes("ProfileFileSignature", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("ProfileFileSignature", ProfileFileSignature);

      int PrimaryPlatformSignature = read4Bytes(
          "PrimaryPlatformSignature", is, "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("PrimaryPlatformSignature",
            PrimaryPlatformSignature);

      int VariousFlags = read4Bytes("ProfileFileSignature", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("ProfileFileSignature", ProfileFileSignature);

      int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("DeviceManufacturer", DeviceManufacturer);

      int DeviceModel = read4Bytes("DeviceModel", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("DeviceModel", DeviceModel);

      skipBytes(is, 8, "Not a Valid ICC Profile");

      int RenderingIntent = read4Bytes("RenderingIntent", is,
          "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("RenderingIntent", RenderingIntent);

      skipBytes(is, 12, "Not a Valid ICC Profile");

      int ProfileCreatorSignature = read4Bytes("ProfileCreatorSignature",
          is, "Not a Valid ICC Profile");
      if (debug)
        printCharQuad("ProfileCreatorSignature",
            ProfileCreatorSignature);

      byte ProfileID[] = null;
      skipBytes(is, 16, "Not a Valid ICC Profile");
      //      readByteArray("ProfileID", 16, is,
      //          "Not a Valid ICC Profile");
      //      if (debug)
      //        System.out
      //            .println("ProfileID: '" + new String(ProfileID) + "'");

      skipBytes(is, 28, "Not a Valid ICC Profile");

      //      this.setDebug(true);

      int TagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");

      //      ArrayList tags = new ArrayList();
      IccTag tags[] = new IccTag[TagCount];

      for (int i = 0; i < TagCount; i++)
      {
        int TagSignature = read4Bytes("TagSignature[" + i + "]", is,
            "Not a Valid ICC Profile");
        //        Debug.debug("TagSignature t "
        //            + Integer.toHexString(TagSignature));

        //        this.printCharQuad("TagSignature", TagSignature);
        int OffsetToData = read4Bytes("OffsetToData[" + i + "]", is,
            "Not a Valid ICC Profile");
        int ElementSize = read4Bytes("ElementSize[" + i + "]", is,
            "Not a Valid ICC Profile");

        IccTagType fIccTagType = getIccTagType(TagSignature);
        //        if (fIccTagType == null)
        //          throw new Error("oops.");

        //        System.out
        //            .println("\t["
        //                + i
        //                + "]: "
        //                + ((fIccTagType == null)
        //                    ? "unknown"
        //                    : fIccTagType.name));
        //        Debug.debug();

        IccTag tag = new IccTag(TagSignature, OffsetToData,
            ElementSize, fIccTagType);
        //        tag.dump("\t" + i + ": ");
        tags[i] = tag;
        //        tags .add(tag);
      }

      {
        // read stream to end, filling cache.
        while (is.read() >= 0)
          ;
      }

      byte data[] = cis.getCache();

      if (data.length < ProfileSize)
        throw new IOException("Couldn't read ICC Profile.");

      IccProfileInfo result = new IccProfileInfo(data, ProfileSize,
View Full Code Here

Examples of org.apache.sanselan.util.CachingInputStream

        return null;
    }

    private IccProfileInfo readICCProfileInfo(InputStream is)
    {
        CachingInputStream cis = new CachingInputStream(is);
        is = cis;

        if (debug)
            Debug.debug();

        //                setDebug(true);

        //        if (debug)
        //            Debug.debug("length: " + length);

        try
        {
            int ProfileSize = read4Bytes("ProfileSize", is,
                    "Not a Valid ICC Profile");

            //            if (length != ProfileSize)
            //            {
            //                //                Debug.debug("Unexpected Length data expected: " + Integer.toHexString((int) length)
            //                //                        + ", encoded: " + Integer.toHexString(ProfileSize));
            //                //                Debug.debug("Unexpected Length data: " + length
            //                //                        + ", length: " + ProfileSize);
            //                //                throw new Error("asd");
            //                return null;
            //            }

            int CMMTypeSignature = read4Bytes("Signature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("CMMTypeSignature", CMMTypeSignature);

            int ProfileVersion = read4Bytes("ProfileVersion", is,
                    "Not a Valid ICC Profile");

            int ProfileDeviceClassSignature = read4Bytes(
                    "ProfileDeviceClassSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileDeviceClassSignature",
                        ProfileDeviceClassSignature);

            int ColorSpace = read4Bytes("ColorSpace", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ColorSpace", ColorSpace);

            int ProfileConnectionSpace = read4Bytes("ProfileConnectionSpace",
                    is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileConnectionSpace", ProfileConnectionSpace);

            skipBytes(is, 12, "Not a Valid ICC Profile");

            int ProfileFileSignature = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileFileSignature", ProfileFileSignature);

            int PrimaryPlatformSignature = read4Bytes(
                    "PrimaryPlatformSignature", is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("PrimaryPlatformSignature",
                        PrimaryPlatformSignature);

            int VariousFlags = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileFileSignature", ProfileFileSignature);

            int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("DeviceManufacturer", DeviceManufacturer);

            int DeviceModel = read4Bytes("DeviceModel", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("DeviceModel", DeviceModel);

            skipBytes(is, 8, "Not a Valid ICC Profile");

            int RenderingIntent = read4Bytes("RenderingIntent", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("RenderingIntent", RenderingIntent);

            skipBytes(is, 12, "Not a Valid ICC Profile");

            int ProfileCreatorSignature = read4Bytes("ProfileCreatorSignature",
                    is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileCreatorSignature",
                        ProfileCreatorSignature);

            byte ProfileID[] = null;
            skipBytes(is, 16, "Not a Valid ICC Profile");
            //            readByteArray("ProfileID", 16, is,
            //                    "Not a Valid ICC Profile");
            //            if (debug)
            //                System.out
            //                        .println("ProfileID: '" + new String(ProfileID) + "'");

            skipBytes(is, 28, "Not a Valid ICC Profile");

            //            this.setDebug(true);

            int TagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");

            //            ArrayList tags = new ArrayList();
            IccTag tags[] = new IccTag[TagCount];

            for (int i = 0; i < TagCount; i++)
            {
                int TagSignature = read4Bytes("TagSignature[" + i + "]", is,
                        "Not a Valid ICC Profile");
                //                Debug.debug("TagSignature t "
                //                        + Integer.toHexString(TagSignature));

                //                this.printCharQuad("TagSignature", TagSignature);
                int OffsetToData = read4Bytes("OffsetToData[" + i + "]", is,
                        "Not a Valid ICC Profile");
                int ElementSize = read4Bytes("ElementSize[" + i + "]", is,
                        "Not a Valid ICC Profile");

                IccTagType fIccTagType = getIccTagType(TagSignature);
                //                if (fIccTagType == null)
                //                    throw new Error("oops.");

                //                System.out
                //                        .println("\t["
                //                                + i
                //                                + "]: "
                //                                + ((fIccTagType == null)
                //                                        ? "unknown"
                //                                        : fIccTagType.name));
                //                Debug.debug();

                IccTag tag = new IccTag(TagSignature, OffsetToData,
                        ElementSize, fIccTagType);
                //                tag.dump("\t" + i + ": ");
                tags[i] = tag;
                //                tags .add(tag);
            }

            {
                // read stream to end, filling cache.
                while (is.read() >= 0)
                    ;
            }

            byte data[] = cis.getCache();

            if (data.length < ProfileSize)
                throw new IOException("Couldn't read ICC Profile.");

            IccProfileInfo result = new IccProfileInfo(data, ProfileSize,
View Full Code Here

Examples of org.apache.sanselan.util.CachingInputStream

        return null;
    }

    private IccProfileInfo readICCProfileInfo(InputStream is)
    {
        CachingInputStream cis = new CachingInputStream(is);
        is = cis;

        if (debug)
            Debug.debug();

        //                setDebug(true);

        //        if (debug)
        //            Debug.debug("length: " + length);

        try
        {
            int ProfileSize = read4Bytes("ProfileSize", is,
                    "Not a Valid ICC Profile");

            //            if (length != ProfileSize)
            //            {
            //                //                Debug.debug("Unexpected Length data expected: " + Integer.toHexString((int) length)
            //                //                        + ", encoded: " + Integer.toHexString(ProfileSize));
            //                //                Debug.debug("Unexpected Length data: " + length
            //                //                        + ", length: " + ProfileSize);
            //                //                throw new Error("asd");
            //                return null;
            //            }

            int CMMTypeSignature = read4Bytes("Signature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("CMMTypeSignature", CMMTypeSignature);

            int ProfileVersion = read4Bytes("ProfileVersion", is,
                    "Not a Valid ICC Profile");

            int ProfileDeviceClassSignature = read4Bytes(
                    "ProfileDeviceClassSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileDeviceClassSignature",
                        ProfileDeviceClassSignature);

            int ColorSpace = read4Bytes("ColorSpace", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ColorSpace", ColorSpace);

            int ProfileConnectionSpace = read4Bytes("ProfileConnectionSpace",
                    is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileConnectionSpace", ProfileConnectionSpace);

            skipBytes(is, 12, "Not a Valid ICC Profile");

            int ProfileFileSignature = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileFileSignature", ProfileFileSignature);

            int PrimaryPlatformSignature = read4Bytes(
                    "PrimaryPlatformSignature", is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("PrimaryPlatformSignature",
                        PrimaryPlatformSignature);

            int VariousFlags = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileFileSignature", ProfileFileSignature);

            int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("DeviceManufacturer", DeviceManufacturer);

            int DeviceModel = read4Bytes("DeviceModel", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("DeviceModel", DeviceModel);

            skipBytes(is, 8, "Not a Valid ICC Profile");

            int RenderingIntent = read4Bytes("RenderingIntent", is,
                    "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("RenderingIntent", RenderingIntent);

            skipBytes(is, 12, "Not a Valid ICC Profile");

            int ProfileCreatorSignature = read4Bytes("ProfileCreatorSignature",
                    is, "Not a Valid ICC Profile");
            if (debug)
                printCharQuad("ProfileCreatorSignature",
                        ProfileCreatorSignature);

            byte ProfileID[] = null;
            skipBytes(is, 16, "Not a Valid ICC Profile");
            //            readByteArray("ProfileID", 16, is,
            //                    "Not a Valid ICC Profile");
            //            if (debug)
            //                System.out
            //                        .println("ProfileID: '" + new String(ProfileID) + "'");

            skipBytes(is, 28, "Not a Valid ICC Profile");

            //            this.setDebug(true);

            int TagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");

            //            ArrayList tags = new ArrayList();
            IccTag tags[] = new IccTag[TagCount];

            for (int i = 0; i < TagCount; i++)
            {
                int TagSignature = read4Bytes("TagSignature[" + i + "]", is,
                        "Not a Valid ICC Profile");
                //                Debug.debug("TagSignature t "
                //                        + Integer.toHexString(TagSignature));

                //                this.printCharQuad("TagSignature", TagSignature);
                int OffsetToData = read4Bytes("OffsetToData[" + i + "]", is,
                        "Not a Valid ICC Profile");
                int ElementSize = read4Bytes("ElementSize[" + i + "]", is,
                        "Not a Valid ICC Profile");

                IccTagType fIccTagType = getIccTagType(TagSignature);
                //                if (fIccTagType == null)
                //                    throw new Error("oops.");

                //                System.out
                //                        .println("\t["
                //                                + i
                //                                + "]: "
                //                                + ((fIccTagType == null)
                //                                        ? "unknown"
                //                                        : fIccTagType.name));
                //                Debug.debug();

                IccTag tag = new IccTag(TagSignature, OffsetToData,
                        ElementSize, fIccTagType);
                //                tag.dump("\t" + i + ": ");
                tags[i] = tag;
                //                tags .add(tag);
            }

            {
                // read stream to end, filling cache.
                while (is.read() >= 0)
                    ;
            }

            byte data[] = cis.getCache();

            if (data.length < ProfileSize)
                throw new IOException("Couldn't read ICC Profile.");

            IccProfileInfo result = new IccProfileInfo(data, ProfileSize,
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.