public float getR4(int id) { Property p = (Property) properties.get(new Integer(id)); try { int offset = p.getOffset(); stream.seek(offset); return stream.readFloatLE(); } catch (IOException e) { ImagingListenerProxy.errorOccurred(JaiI18N.getString("PropertySet6"), e, this, false); // e.printStackTrace(); return -1.0F; } }
public int getUI1(int id) { Property p = (Property) properties.get(new Integer(id)); try { int offset = p.getOffset(); stream.seek(offset); return stream.readUnsignedByte(); } catch (IOException e) { ImagingListenerProxy.errorOccurred(JaiI18N.getString("PropertySet1"), e, this, false); // e.printStackTrace(); } return -1; }
public long getUI4(int id, long defaultValue) { Property p = (Property) properties.get(new Integer(id)); if (p == null) { return defaultValue; } try { int offset = p.getOffset(); stream.seek(offset); return stream.readUnsignedIntLE(); } catch (IOException e) { ImagingListenerProxy.errorOccurred(JaiI18N.getString("PropertySet4"), e, this, false); // e.printStackTrace(); } return -1; }
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; } }
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; } }
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); } }