Package org.apache.sanselan

Examples of org.apache.sanselan.ImageWriteException


            params.remove(PARAM_KEY_FORMAT);

        if (params.size() > 0)
        {
            Object firstKey = params.keySet().iterator().next();
            throw new ImageWriteException("Unknown parameter: " + firstKey);
        }

        writeMultiByteInteger(os, 0); // typeField
        os.write(0); // fixHeaderField
        writeMultiByteInteger(os, src.getWidth());
View Full Code Here


    if (params.containsKey(PARAM_KEY_FORMAT))
      params.remove(PARAM_KEY_FORMAT);

    if (params.size() > 0) {
      Object firstKey = params.keySet().iterator().next();
      throw new ImageWriteException("Unknown parameter: " + firstKey);
    }

    writer.writeImage(src, os, params);
  }
View Full Code Here

    if (o instanceof byte[])
      return (byte[]) o;
    else if (o instanceof String)
      return ((String) o).getBytes();
    else
      throw new ImageWriteException("Unknown data type: " + o);
  }
View Full Code Here

  public static TiffOutputField create(TagInfo tagInfo, int byteOrder,
      Number number) throws ImageWriteException
  {
    if (tagInfo.dataTypes == null || tagInfo.dataTypes.length < 1)
      throw new ImageWriteException("Tag has no default data type.");
    FieldType fieldType = tagInfo.dataTypes[0];

    if (tagInfo.length != 1)
      throw new ImageWriteException("Tag does not expect a single value.");

    byte bytes[] = fieldType.writeData(number, byteOrder);

    return new TiffOutputField(tagInfo.tag, tagInfo, fieldType, 1, bytes);
  }
View Full Code Here

  public static TiffOutputField create(TagInfo tagInfo, int byteOrder,
      Number value[]) throws ImageWriteException
  {
    if (tagInfo.dataTypes == null || tagInfo.dataTypes.length < 1)
      throw new ImageWriteException("Tag has no default data type.");
    FieldType fieldType = tagInfo.dataTypes[0];

    if (tagInfo.length != value.length)
      throw new ImageWriteException("Tag does not expect a single value.");

    byte bytes[] = fieldType.writeData(value, byteOrder);

    return new TiffOutputField(tagInfo.tag, tagInfo, fieldType, value.length, bytes);
  }
View Full Code Here

    if (tagInfo.dataTypes == null)
      fieldType = FIELD_TYPE_ASCII;
    else if (tagInfo.dataTypes == FIELD_TYPE_DESCRIPTION_ASCII)
      fieldType = FIELD_TYPE_ASCII;
    else
      throw new ImageWriteException("Tag has unexpected data type.");

    byte bytes[] = fieldType.writeData(value, byteOrder);

    return new TiffOutputField(tagInfo.tag, tagInfo, fieldType, 1, bytes);
  }
View Full Code Here

    bos.write4Bytes(count);

    if (isLocalValue())
    {
      if (separateValueItem != null)
        throw new ImageWriteException("Unexpected separate value item.");

      bos.writeByteArray(bytes);
      int remainder = TIFF_ENTRY_MAX_VALUE_LENGTH - bytes.length;
      for (int i = 0; i < remainder; i++)
        bos.write(0);
    }
    else
    {
      if (separateValueItem == null)
        throw new ImageWriteException("Missing separate value item.");

      bos.write4Bytes(separateValueItem.getOffset());

      int written = bytes.length;
      if ((written % 2) != 0)
View Full Code Here

    //    if(tagInfo.isUnknown())
    //      Debug.debug("unknown tag(0x" + Integer.toHexString(tag)
    //          + ") setData", bytes);

    if (this.bytes.length != bytes.length)
      throw new ImageWriteException("Cannot change size of value.");

    //    boolean wasLocalValue = isLocalValue();
    this.bytes = bytes;
    //    if (isLocalValue() != wasLocalValue)
    //      throw new Error("Bug. Locality disrupted! "
View Full Code Here

  protected void setByteOrder(int a, int b) throws ImageWriteException,
      IOException
  {
    if (a != b)
      throw new ImageWriteException("Byte Order bytes don't match (" + a
          + ", " + b + ").");

    if (a == BYTE_ORDER_MOTOROLA)
      byteOrder = a;
    else if (a == BYTE_ORDER_INTEL)
      byteOrder = a;
    else
      throw new ImageWriteException("Unknown Byte Order hint: " + a);
  }
View Full Code Here

      params.remove(PARAM_KEY_FORMAT);

    if (params.size() > 0)
    {
      Object firstKey = params.keySet().iterator().next();
      throw new ImageWriteException("Unknown parameter: " + firstKey);
    }

    SimplePalette palette = new PaletteFactory()
        .makePaletteSimple(src, 256);
View Full Code Here

TOP

Related Classes of org.apache.sanselan.ImageWriteException

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.