Package net.sourceforge.jiu.codecs

Examples of net.sourceforge.jiu.codecs.WrongFileFormatException


    {
      setByteOrder(BYTE_ORDER_MOTOROLA);
    }
    else
    {
      throw new WrongFileFormatException("Not a TIFF file (does not " +
        "begin with II or MM followed by 42).");
    }
    nextIfdOffset = readInt();
  }
View Full Code Here


    byte[] header = new byte[RAS_HEADER_SIZE];
    in.readFully(header);
    int magic = ArrayConverter.getIntBE(header, 0);
    if (magic != RAS_MAGIC)
    {
      throw new WrongFileFormatException("This stream is not a valid " +
        "Sun RAS stream (bad magic: " + Integer.toHexString(magic) +
        " instead of " + Integer.toHexString(RAS_MAGIC));
    }
    width = ArrayConverter.getIntBE(header, 4);
    height = ArrayConverter.getIntBE(header, 8);
View Full Code Here

      throw new IllegalArgumentException("Input file is missing " +
        "(use PCDCodec.setInput(RandomAccessFile).");
    }
    if (in.length() < 16 * 1024)
    {
      throw new WrongFileFormatException("Not a PCD file.");
    }
    byte[] sector = new byte[SECTOR_SIZE];
    // read first sector; first 7 bytes must be 0xff
    in.readFully(sector);
    for (int i = 0; i < 7; i++)
    {
      if (sector[i] != -1)
      {
        throw new WrongFileFormatException("Input is not a valid PCD " +
          "file (wrong magic byte sequence).");
      }
    }
    // read second sector and check more magic bytes
    in.readFully(sector);
    for (int i = 0; i < MAGIC.length; i++)
    {
      if (sector[i] != MAGIC[i])
      {
        throw new WrongFileFormatException("Input is not a valid PCD " +
          "file (wrong magic byte sequence).");
      }
    }
    // get image orientation and resolution
    int rotationAngle = sector[0x602] & 0x03;
View Full Code Here

      throw new MissingParameterException("InputStream / DataInput object is missing.");
    }
    int formMagic = in.readInt();
    if (formMagic != MAGIC_FORM)
    {
      throw new WrongFileFormatException("Cannot load image. The " +
        "input stream is not a valid IFF file (wrong magic byte " +
        "sequence).");
    }
    in.readInt(); // read and discard "file size" field
    type = in.readInt();
View Full Code Here

  {
    byte[] header = new byte[54];
    in.readFully(header);
    if (header[0] != 'B' || header[1] != 'M')
    {
      throw new WrongFileFormatException("Not a BMP file (first two bytes are not 0x42 0x4d).");
    }
    dataOffset = ArrayConverter.getIntLE(header, 0x0a);
    if (dataOffset < 54)
    {
      throw new InvalidFileStructureException("BMP data expected to be 54dec or larger, got " + dataOffset);
View Full Code Here

    if (width < 1 || height < 1 ||
        unsupportedDirectColor ||
        (bitsPerPixel != 1 && bitsPerPixel != 2 && bitsPerPixel != 4 && bitsPerPixel != 8 && bitsPerPixel != 16) ||
        (compression != COMPRESSION_NONE && compression != COMPRESSION_RLE && compression != COMPRESSION_SCANLINE))
    {
      throw new WrongFileFormatException("Not a file in Palm image file format.");
    }
    /*System.out.println("width=" + width + ", height=" + height + ", bytes per row=" +
      bytesPerRow + ", flags=" + flags + ", bpp=" + bitsPerPixel + ", version=" +
      version + ", palette=" + (((flags & FLAG_COLOR_TABLE) != 0) ? "y" : "n") +
      ", transparent=" + transparencyIndex + ", compression=" + compression);*/
 
View Full Code Here

      return;
    }
    int numEntries = in.readShort() & 0xffff;
    if (numEntries < 1 || numEntries > 256)
    {
      throw new WrongFileFormatException("Not a Palm image file, invalid number of palette entries: "  + numEntries);
    }
    palette = new Palette(numEntries, 255);
    for (int i = 0; i < numEntries; i++)
    {
      //int reserved = in.readUnsignedByte();
View Full Code Here

      byte[] data = new byte[4];
      in.readFully(data, 0, 2);
      int signature = ArrayConverter.getShortBEAsInt(data, 0);
      if (signature != JPEGConstants.JFIF_SIGNATURE)
      {
        throw new WrongFileFormatException(
          "Not a JFIF file (first two bytes are not 0xff 0xd8).");
      }
      // continuously read markers, updating a JPEGData object
      JPEGData jpegData = new JPEGData();
      while (true)
View Full Code Here

    WrongFileFormatException
  {
    magic = in.readInt();
    if (magic != MAGIC_8BPS)
    {
      throw new WrongFileFormatException("Not a valid PSD file " +
        "(wrong magic byte sequence).");
    }
    in.readShort(); // skip version short value
    in.skipBytes(6);
    channels = in.readShort();
View Full Code Here

TOP

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

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.