683 public static final int icHdrRenderingIntent = 64; /* Rendering intent */
684
685 /**
686 * ICC Profile Header Location: profile illuminant.
687 */
688 public static final int icHdrIlluminant = 68; /* Profile illuminant */
689
690 /**
691 * ICC Profile Header Location: profile creator.
692 */
693 public static final int icHdrCreator = 80; /* Profile creator */
694
695 /**
696 * ICC Profile Header Location: profile's ID.
697 * @since 1.5
698 */
699 public static final int icHdrProfileID = 84; /* Profile's ID */
700
701
702 /**
703 * ICC Profile Constant: tag type signaturE.
704 */
705 public static final int icTagType = 0; /* tag type signature */
706
707 /**
708 * ICC Profile Constant: reserved.
709 */
710 public static final int icTagReserved = 4; /* reserved */
711
712 /**
713 * ICC Profile Constant: curveType count.
714 */
715 public static final int icCurveCount = 8; /* curveType count */
716
717 /**
718 * ICC Profile Constant: curveType data.
719 */
720 public static final int icCurveData = 12; /* curveType data */
721
722 /**
723 * ICC Profile Constant: XYZNumber X.
1857 * returns null.
1858 */
1859 private static InputStream getStandardProfileInputStream(String fileName) {
1860 return PCMM.class.getResourceAsStream("profiles/" + fileName);
1861 }
1862
1863 /**
1864 * Checks whether given file resides inside give directory.
1865 */
1866 private static boolean isChildOf(File f, String dirName) {
1867 try {
1868 File dir = new File(dirName);
1869 String canonicalDirName = dir.getCanonicalPath();
1870 if (!canonicalDirName.endsWith(File.separator)) {
1871 canonicalDirName += File.separator;
1872 }
1873 String canonicalFileName = f.getCanonicalPath();
1874 return canonicalFileName.startsWith(canonicalDirName);
1875 } catch (IOException e) {
1876 /* we do not expect the IOException here, because invocation
1877 * of this function is always preceeded by isFile() call.
1878 */
1879 return false;
1880 }
1881 }
1882
1883 /**
1884 * Checks whether built-in profile specified by fileName exists.
1885 */
1886 private static boolean standardProfileExists(final String fileName) {
1887 return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
1888 public Boolean run() {
1889 return PCMM.class.getResource("profiles/"+fileName) != null;
1890 }
1891 });
1892 }
1893
1894
1895 /*
1896 * Serialization support.
1897 *
1898 * Directly deserialized profiles are useless since they are not
1899 * registered with CMM. We don't allow constructor to be called
1900 * directly and instead have clients to call one of getInstance
1901 * factory methods that will register the profile with CMM. For
1902 * deserialization we implement readResolve method that will
1903 * resolve the bogus deserialized profile object with one obtained
1904 * with getInstance as well.
1905 *
1906 * There're two primary factory methods for construction of ICC
1907 * profiles: getInstance(int cspace) and getInstance(byte[] data).
1908 * This implementation of ICC_Profile uses the former to return a
1909 * cached singleton profile object, other implementations will
1910 * likely use this technique too. To preserve the singleton
1911 * pattern across serialization we serialize cached singleton
1912 * profiles in such a way that deserializing VM could call
1913 * getInstance(int cspace) method that will resolve deserialized
1914 * object into the corresponding singleton as well.
1915 *
1916 * Since the singletons are private to ICC_Profile the readResolve
1917 * method have to be `protected' instead of `private' so that
1918 * singletons that are instances of subclasses of ICC_Profile
1919 * could be correctly deserialized.
1920 */
1921
1922
1923 /**
1924 * Version of the format of additional serialized data in the
1925 * stream. Version <code>1</code> corresponds to Java 2
1926 * Platform, v1.3.
|
683 public static final int icHdrRenderingIntent = 64; /* Rendering intent */
684
685 /**
686 * ICC Profile Header Location: profile illuminant.
687 */
688 public static final int icHdrIlluminant = 68; /* Profile illuminant */
689
690 /**
691 * ICC Profile Header Location: profile creator.
692 */
693 public static final int icHdrCreator = 80; /* Profile creator */
694
695 /**
696 * ICC Profile Header Location: profile's ID.
697 * @since 1.5
698 */
699 public static final int icHdrProfileID = 84; /* Profile's ID */
700
701
702 /**
703 * ICC Profile Constant: tag type signature.
704 */
705 public static final int icTagType = 0; /* tag type signature */
706
707 /**
708 * ICC Profile Constant: reserved.
709 */
710 public static final int icTagReserved = 4; /* reserved */
711
712 /**
713 * ICC Profile Constant: curveType count.
714 */
715 public static final int icCurveCount = 8; /* curveType count */
716
717 /**
718 * ICC Profile Constant: curveType data.
719 */
720 public static final int icCurveData = 12; /* curveType data */
721
722 /**
723 * ICC Profile Constant: XYZNumber X.
1857 * returns null.
1858 */
1859 private static InputStream getStandardProfileInputStream(String fileName) {
1860 return PCMM.class.getResourceAsStream("profiles/" + fileName);
1861 }
1862
1863 /**
1864 * Checks whether given file resides inside give directory.
1865 */
1866 private static boolean isChildOf(File f, String dirName) {
1867 try {
1868 File dir = new File(dirName);
1869 String canonicalDirName = dir.getCanonicalPath();
1870 if (!canonicalDirName.endsWith(File.separator)) {
1871 canonicalDirName += File.separator;
1872 }
1873 String canonicalFileName = f.getCanonicalPath();
1874 return canonicalFileName.startsWith(canonicalDirName);
1875 } catch (IOException e) {
1876 /* we do not expect the IOException here, because invocation
1877 * of this function is always preceded by isFile() call.
1878 */
1879 return false;
1880 }
1881 }
1882
1883 /**
1884 * Checks whether built-in profile specified by fileName exists.
1885 */
1886 private static boolean standardProfileExists(final String fileName) {
1887 return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
1888 public Boolean run() {
1889 return PCMM.class.getResource("profiles/"+fileName) != null;
1890 }
1891 });
1892 }
1893
1894
1895 /*
1896 * Serialization support.
1897 *
1898 * Directly deserialized profiles are useless since they are not
1899 * registered with CMM. We don't allow constructor to be called
1900 * directly and instead have clients to call one of getInstance
1901 * factory methods that will register the profile with CMM. For
1902 * deserialization we implement readResolve method that will
1903 * resolve the bogus deserialized profile object with one obtained
1904 * with getInstance as well.
1905 *
1906 * There are two primary factory methods for construction of ICC
1907 * profiles: getInstance(int cspace) and getInstance(byte[] data).
1908 * This implementation of ICC_Profile uses the former to return a
1909 * cached singleton profile object, other implementations will
1910 * likely use this technique too. To preserve the singleton
1911 * pattern across serialization we serialize cached singleton
1912 * profiles in such a way that deserializing VM could call
1913 * getInstance(int cspace) method that will resolve deserialized
1914 * object into the corresponding singleton as well.
1915 *
1916 * Since the singletons are private to ICC_Profile the readResolve
1917 * method have to be `protected' instead of `private' so that
1918 * singletons that are instances of subclasses of ICC_Profile
1919 * could be correctly deserialized.
1920 */
1921
1922
1923 /**
1924 * Version of the format of additional serialized data in the
1925 * stream. Version <code>1</code> corresponds to Java 2
1926 * Platform, v1.3.
|