List of usage examples for org.apache.poi.hssf.record DConRefRecord isExternalRef
public boolean isExternalRef()
From source file:org.ddt.listener.records.DConRefListener.java
License:Apache License
public void processRecord(Record record) { if (record.getSid() == DConRefRecord.sid) { DConRefRecord dcr = new DConRefRecord(record.serialize()); if (!dcr.isExternalRef()) { log.log(Level.FINE, "Not an external ref: {0}", dcr.toString()); return; }/*from ww w. ja v a2s. c o m*/ byte[] path = dcr.getPath(); String linkString = cleanPath(path); if (linkString != null && !linkString.trim().equals("")) ; { Link l = new Link(5); byte type = path[1]; //types relative to startup dir | alt-startup dir | library dir | simple-file-path if (type == 0x06 || type == 0x07 || type == 0x08 || type > 0x40) l.addRelativePath(linkString); else if (type == 0x01) { if (path[2] == 0x40) //UNC path. { l.addAbsolutePath(linkString); } else if (path[2] > 0x40) //relative to drive letter, remove drive letter { char drive = (char) path[2]; l.addRelativePath(linkString.replaceFirst(String.valueOf(drive), "")); } } else l.addUnkownPath(linkString); this.add(l); } } }
From source file:org.ddt.listener.records.DConRefRecordTest.java
License:Apache License
/** * Test of isExternalRef method, of class DConRefRecord. *//* ww w.j av a 2 s . c o m*/ @Test public void testIsExternalRef() { DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1)); assertTrue("external reference", instance.isExternalRef()); instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data2)); assertFalse("internal reference", instance.isExternalRef()); }