@Override public boolean equals(Object other) { if (!(other instanceof DocumentDelegate)) { return false; } DocumentDelegate dd = (DocumentDelegate)other; if (this == dd) { return true; } if (!Objects.equals(doc.getName(), dd.doc.getName())) { // Names don't match, not the same return false; } try (DocumentInputStream inpA = new DocumentInputStream(doc); DocumentInputStream inpB = new DocumentInputStream(dd.doc)) { if (PropertySet.isPropertySetStream(inpA) && PropertySet.isPropertySetStream(inpB)) { final PropertySet ps1 = PropertySetFactory.create(inpA); final PropertySet ps2 = PropertySetFactory.create(inpB); return ps1.equals(ps2); } else { return isEqual(inpA, inpB); } } catch (MarkUnsupportedException | NoPropertySetStreamException | IOException ex) { throw new RuntimeException(ex); } }
@Override public boolean equals(Object other) { if (!(other instanceof DocumentDelegate)) { return false; } DocumentDelegate dd = (DocumentDelegate)other; if (this == dd) { return true; } if (!Objects.equals(doc.getName(), dd.doc.getName())) { // Names don't match, not the same return false; } try (DocumentInputStream inpA = new DocumentInputStream(doc); DocumentInputStream inpB = new DocumentInputStream(dd.doc)) { if (PropertySet.isPropertySetStream(inpA) && PropertySet.isPropertySetStream(inpB)) { final PropertySet ps1 = PropertySetFactory.create(inpA); final PropertySet ps2 = PropertySetFactory.create(inpB); return ps1.equals(ps2); } else { return isEqual(inpA, inpB); } } catch (MarkUnsupportedException | NoPropertySetStreamException | IOException ex) { throw new RuntimeException(ex); } }