Package net.sourceforge.jiu.codecs

Examples of net.sourceforge.jiu.codecs.InvalidFileStructureException


          return pair[TIFFFaxCodes.INDEX_CODE_VALUE];
        }
      }
      code = (code << 1) | readBit();
    }
    throw new InvalidFileStructureException("Could not identify Huffman code in TIFF file.");
  }
View Full Code Here


  {
    // make sure marker is a valid marker
    if ((marker >> 8) != 0xff)
    {
      // TODO: instead of giving up, search for next occurrence of 0xff (error recovery)
      throw new InvalidFileStructureException("Marker " +
        marker + " does not have 0xff in its top eight bits.");
    }
    // zero out everything but the least significant byte
    marker &= 0xff;
    // decrease two bytes for the marker length field
View Full Code Here

    loadHeader();
    //System.out.println(width + " x " + height + ", color=" + colorMode + ", channels=" + channels + ", depth=" + depth);
    // check values
    if (width < 1 || height < 1)
    {
      throw new InvalidFileStructureException("Cannot load image. " +
        "Invalid pixel resolution in PSD file header (" + width +
        " x " + height + ").");
    }
    if (colorMode != COLOR_MODE_RGB_TRUECOLOR &&
        colorMode != COLOR_MODE_GRAYSCALE &&
        colorMode != COLOR_MODE_INDEXED)
    {
      throw new UnsupportedTypeException("Cannot load image. Only RGB" +
        " truecolor and indexed color are supported for PSD files. " +
        "Found: " +getColorTypeName(colorMode));
    }
    if (depth != 8)
    {
      throw new UnsupportedTypeException("Cannot load image. Only a depth of 8 bits " +
        "per channel is supported (found " + depth +
        " bits).");
    }

    // COLOR MODE DATA
    int colorModeSize = in.readInt();
    //System.out.println("colorModeSize=" + colorModeSize);
    byte[] colorMap = null;
    if (colorMode == COLOR_MODE_INDEXED)
    {
      if (colorModeSize != 768)
      {
        throw new InvalidFileStructureException("Cannot load image." +
          " Color map length was expected to be 768 (found " +
          colorModeSize + ").");
      }
      colorMap = new byte[colorModeSize];
      in.readFully(colorMap);
View Full Code Here

           this would result in an IndexOutOfBoundsException
           thrown by the virtual machine;
           to give a more understandable error message to the
           user, this exception is caught here and a
           corresponding IOException is thrown */
        throw new InvalidFileStructureException("Error: RLE-compressed image " +
          "file seems to be corrupt (x=" + x +
          ", count=" + (compressed ? (-((int)n) + 1) : n) +
          ", compressed=" + (compressed ? "y" : "n") + ", array length=" + data.length + ").");
      }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.jiu.codecs.InvalidFileStructureException

Copyright © 2018 www.massapicom. 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.