ContentName extends GenericXMLEncodable implements XMLEncodable, Comparable<ContentName>, Serializable, ContentNameProvider, Iterable<byte []> { public ContentName postfix(ContentName prefix) { if (!prefix.isPrefixOf(this)) return null; return subname(prefix._components.length, _components.length); } ContentName(); @Deprecated protected  ContentName(ArrayList<byte[]> components);  ContentName(byte[] component);  ContentName(Object... args);  ContentName(ContentName parent, byte[] component);  ContentName(ContentName parent, ContentNameProvider cnp);  ContentName(ContentName parent, String component);  ContentName(ContentName parent, ComponentProvider cprov);  ContentName(byte components[][]); @Deprecated  ContentName(ContentName parent, byte [][] childComponents); @Deprecated  ContentName(ContentName parent, ArrayList<byte []> childComponents); @Deprecated  ContentName(ContentName parent, int start, ArrayList<byte []> childComponents); @Deprecated  ContentName(int count, byte components[][]); @Deprecated  ContentName(int count, ArrayList<byte []>components); @Deprecated  ContentName(int start, int count, ArrayList<byte []>components);  ContentName(ContentName otherName); final ContentName getContentName(); static ContentName fromURI(String name); @Deprecated static ContentName fromURI(String parts[]); @Deprecated static ContentName fromURI(ContentName parent, String name); static ContentName fromNative(String name); @Deprecated static ContentName fromNative(ContentName parent, String name); @Deprecated static ContentName fromNative(ContentName parent, byte [] name); @Deprecated static ContentName fromNative(ContentName parent, String name1, String name2); @Deprecated static ContentName fromNative(String [] parts); @Deprecated static ContentName fromNative(ContentName parent, String [] parts); ContentName parent(); @Override String toString(); String toURIString(); @Deprecated static String componentPrintURI(byte[] bs, int offset, int length); @Deprecated static String componentPrintURI(byte [] bs); @Deprecated static String componentPrintNative(byte[] bs); @Deprecated static String hexPrint(byte [] bs); @Deprecated static byte[] componentParseURI(String name); @Deprecated static byte[] componentParseNative(String name); @Deprecated ArrayList<byte[]> components(); int count(); ContentName append(ContentName other); ContentName append(String postfix); final byte[] component(int i); final byte [] lastComponent(); String stringComponent(int i); @Override void decode(XMLDecoder decoder); boolean isPrefixOf(ContentName name); boolean isPrefixOf(ContentName name, int count); boolean isPrefixOf(ContentObject other); boolean isPrefixOf(ContentObject other, int count); @Override boolean equals(Object obj); @Override int hashCode(); @Deprecated static ContentName parse(String str); @Deprecated boolean contains(String str); boolean contains(byte [] component); boolean contains(ComponentProvider cp); int containsWhere(String str); int containsWhere(ComponentProvider cp); int whereLast(String str); int containsWhere(byte [] component); int whereLast(byte [] component); int whereLast(ComponentProvider cp); @Deprecated boolean startsWith(byte [] value); @Deprecated int startsWithWhere(byte [] value); boolean componentStartsWith(byte [] value); int componentStartsWithWhere(byte [] value); ContentName cut(int componentCount); ContentName right(int position); ContentName cut(byte [] component); @Deprecated ContentName cut(String component); ContentName subname(int start, int end); int matchLength(ContentName name); ContentName postfix(ContentName prefix); @Override void encode(XMLEncoder encoder); @Override boolean validate(); @Override long getElementLabel(); @Deprecated ContentName copy(int nameComponentCount); int compareTo(ContentName o); Iterator<byte[]> iterator(); static final String SCHEME; static final String ORIGINAL_SCHEME; static final String SEPARATOR; static final ContentName ROOT; }
@Test public void testPostfix() throws MalformedContentNameStringException { Log.info(Log.FAC_TEST, "Starting testPostfix"); assertEquals( fromNative("/a/b/c/d/e").postfix(fromNative("/a/b/c")), fromNative("/d/e") ); assertEquals( fromNative("/a/b/c").postfix(fromNative("/a/b/c")), ROOT ); assertEquals( fromNative("/a/b/c").postfix(fromNative("/a/b/d/e")), null ); Log.info(Log.FAC_TEST, "Completed testPostfix"); }