1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17/** 18 * @author Oleg V. Khaschansky 19 * @version $Revision$ 20 */ 21 22package java.awt.color; 23 24import java.io.IOException; 25import java.io.InputStream; 26import java.io.ObjectStreamException; 27import java.io.OutputStream; 28 29import org.apache.harmony.awt.internal.nls.Messages; 30 31final class ICC_ProfileStub extends ICC_Profile { 32 private static final long serialVersionUID = 501389760875253507L; 33 34 transient int colorspace; 35 36 public ICC_ProfileStub(int csSpecifier) { 37 switch (csSpecifier) { 38 case ColorSpace.CS_sRGB: 39 case ColorSpace.CS_CIEXYZ: 40 case ColorSpace.CS_LINEAR_RGB: 41 case ColorSpace.CS_PYCC: 42 case ColorSpace.CS_GRAY: 43 break; 44 default: 45 // awt.15D=Invalid colorspace 46 throw new IllegalArgumentException(Messages.getString("awt.15D")); //$NON-NLS-1$ 47 } 48 colorspace = csSpecifier; 49 } 50 51 @Override 52 public void write(String fileName) throws IOException { 53 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 54 } 55 56 /** 57 * Serializable implementation 58 * 59 * @throws ObjectStreamException 60 */ 61 private Object writeReplace() throws ObjectStreamException { 62 return loadProfile(); 63 } 64 65 @Override 66 public void write(OutputStream s) throws IOException { 67 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 68 } 69 70 @Override 71 public void setData(int tagSignature, byte[] tagData) { 72 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 73 } 74 75 @Override 76 public byte[] getData(int tagSignature) { 77 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 78 } 79 80 @Override 81 public byte[] getData() { 82 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 83 } 84 85 @Override 86 protected void finalize() { 87 } 88 89 @Override 90 public int getProfileClass() { 91 return CLASS_COLORSPACECONVERSION; 92 } 93 94 @Override 95 public int getPCSType() { 96 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 97 } 98 99 @Override 100 public int getNumComponents() { 101 switch (colorspace) { 102 case ColorSpace.CS_sRGB: 103 case ColorSpace.CS_CIEXYZ: 104 case ColorSpace.CS_LINEAR_RGB: 105 case ColorSpace.CS_PYCC: 106 return 3; 107 case ColorSpace.CS_GRAY: 108 return 1; 109 default: 110 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 111 } 112 } 113 114 @Override 115 public int getMinorVersion() { 116 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 117 } 118 119 @Override 120 public int getMajorVersion() { 121 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 122 } 123 124 @Override 125 public int getColorSpaceType() { 126 switch (colorspace) { 127 case ColorSpace.CS_sRGB: 128 case ColorSpace.CS_LINEAR_RGB: 129 return ColorSpace.TYPE_RGB; 130 case ColorSpace.CS_CIEXYZ: 131 return ColorSpace.TYPE_XYZ; 132 case ColorSpace.CS_PYCC: 133 return ColorSpace.TYPE_3CLR; 134 case ColorSpace.CS_GRAY: 135 return ColorSpace.TYPE_GRAY; 136 default: 137 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 138 } 139 } 140 141 public static ICC_Profile getInstance(String fileName) throws IOException { 142 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 143 } 144 145 public static ICC_Profile getInstance(InputStream s) throws IOException { 146 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 147 } 148 149 public static ICC_Profile getInstance(byte[] data) { 150 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 151 } 152 153 public static ICC_Profile getInstance(int cspace) { 154 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 155 } 156 157 public ICC_Profile loadProfile() { 158 switch (colorspace) { 159 case ColorSpace.CS_sRGB: 160 return ICC_Profile.getInstance(ColorSpace.CS_sRGB); 161 case ColorSpace.CS_GRAY: 162 return ICC_Profile.getInstance(ColorSpace.CS_GRAY); 163 case ColorSpace.CS_CIEXYZ: 164 return ICC_Profile.getInstance(ColorSpace.CS_CIEXYZ); 165 case ColorSpace.CS_LINEAR_RGB: 166 return ICC_Profile.getInstance(ColorSpace.CS_LINEAR_RGB); 167 case ColorSpace.CS_PYCC: 168 return ICC_Profile.getInstance(ColorSpace.CS_PYCC); 169 default: 170 throw new UnsupportedOperationException("Stub cannot perform this operation"); //$NON-NLS-1$ 171 } 172 } 173}