Ejemplo n.º 1
0
  public int getI4(int id) {
    Property p = (Property) properties.get(new Integer(id));
    try {
      int offset = p.getOffset();
      stream.seek(offset);
      return stream.readIntLE();
    } catch (IOException e) {
      ImagingListenerProxy.errorOccurred(JaiI18N.getString("PropertySet1"), e, this, false);
      //            e.printStackTrace();
    }

    return -1;
  }
Ejemplo n.º 2
0
  public byte[] getBlob(int id) {
    Property p = (Property) properties.get(new Integer(id));
    try {
      int offset = p.getOffset();
      stream.seek(offset);
      int length = stream.readIntLE();

      byte[] buf = new byte[length];
      stream.seek(offset + 4);
      stream.readFully(buf);

      return buf;
    } catch (IOException e) {
      ImagingListenerProxy.errorOccurred(JaiI18N.getString("PropertySet7"), e, this, false);
      //            e.printStackTrace();
      return null;
    }
  }
Ejemplo n.º 3
0
  public String getLPWSTR(int id) {
    Property p = (Property) properties.get(new Integer(id));
    try {
      int offset = p.getOffset();

      stream.seek(offset);
      int length = stream.readIntLE();
      StringBuffer sb = new StringBuffer(length);
      for (int i = 0; i < length; i++) {
        sb.append(stream.readCharLE());
      }

      return sb.toString();
    } catch (IOException e) {
      ImagingListenerProxy.errorOccurred(JaiI18N.getString("PropertySet5"), e, this, false);
      //            e.printStackTrace();
      return null;
    }
  }
Ejemplo n.º 4
0
  public PropertySet(SeekableStream stream) throws IOException {
    this.stream = stream;

    stream.seek(44);
    int sectionOffset = stream.readIntLE();

    stream.seek(sectionOffset);
    int sectionSize = stream.readIntLE();
    int sectionCount = stream.readIntLE();

    for (int i = 0; i < sectionCount; i++) {
      stream.seek(sectionOffset + 8 * i + 8);
      int pid = stream.readIntLE();
      int offset = stream.readIntLE();

      stream.seek(sectionOffset + offset);
      int type = stream.readIntLE();

      Property p = new Property(type, sectionOffset + offset + 4);
      properties.put(new Integer(pid), p);
    }
  }