public Ico(InputStream is) throws BadIcoResException, IOException { try { read(is); parseICOImage(); } finally { try { is.close(); } catch (IOException ignored) { } } }
if (icoPlaneMap == null) { Ico ico = new Ico(icoInputStream); icoPlaneMap = new TreeMap<Integer, BufferedImage>(); for (int i = 0; i < ico.getNumImages(); i++) { BufferedImage icoPlane = ico.getImage(i); widths.add(icoPlane.getWidth()); for (int i = 0; i < ico.getNumImages(); i++) { BufferedImage icoPlane = ico.getImage(i); if (icoPlane.getWidth() != width) continue; int icoPlaneColorCount = ico.getNumColors(i); if (icoPlaneColorCount == 0) { bestMatch = icoPlane;
numImages = ubyte(icoimage[5]); numImages <<= 8; numImages |= icoimage[4]; int width = ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH]); int height = ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 1]); colorCount[i] = ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 2]); int bytesInRes = ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 11]); bytesInRes <<= 8; bytesInRes |= ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 10]); bytesInRes <<= 8; bytesInRes |= ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 9]); bytesInRes <<= 8; bytesInRes |= ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 8]); int imageOffset = ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 15]); imageOffset <<= 8; imageOffset |= ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 14]); imageOffset <<= 8; imageOffset |= ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 13]); imageOffset <<= 8; imageOffset |= ubyte(icoimage[FDE_OFFSET + i * DE_LENGTH + 12]); int _width = ubyte(icoimage[imageOffset + 7]); _width <<= 8; _width |= ubyte(icoimage[imageOffset + 6]);