@Override public boolean isSkippable() { return typeA.isSkippable() && typeB.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeD.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeC.isSkippable(); }
preservesOrder = false; if (i < this.fields.length - 2 && !dt.isSkippable()) { throw new IllegalArgumentException("Field in position " + i + " is not skippable. Non-right-most struct fields must be skippable."); if (!dt.isSkippable()) { skippable = false;
/** * Skip {@code src}'s position forward over one encoded value. * @param src the buffer containing the encoded value. * @return number of bytes skipped. * @throws IllegalArgumentException when the terminator sequence is not found. */ @Override public int skip(PositionedByteRange src) { if (wrapped.isSkippable()) { int ret = wrapped.skip(src); src.setPosition(src.getPosition() + term.length); return ret + term.length; } else { // find the terminator position final int start = src.getPosition(); int skipped = terminatorPosition(src); if (-1 == skipped) { throw new IllegalArgumentException("Terminator sequence not found."); } skipped += term.length; src.setPosition(skipped); return skipped - start; } }
@Override public T decode(PositionedByteRange src) { if (wrapped.isSkippable()) { T ret = wrapped.decode(src); src.setPosition(src.getPosition() + term.length); return ret; } else { // find the terminator position int term = terminatorPosition(src); if (-1 == term) { throw new IllegalArgumentException("Terminator sequence not found."); } byte[] b = new byte[term - src.getPosition()]; src.get(b); // TODO: should we assert that b.position == b.length? T ret = wrapped.decode(new SimplePositionedMutableByteRange(b)); src.get(this.term); return ret; } }
@Override public boolean isSkippable() { return typeA.isSkippable() && typeB.isSkippable(); }
@Override public boolean isSkippable() { return typeA.isSkippable() && typeB.isSkippable(); }
@Override public boolean isSkippable() { return typeA.isSkippable() && typeB.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeD.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeD.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeC.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeC.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeC.isSkippable(); }
@Override public boolean isSkippable() { return super.isSkippable() && typeD.isSkippable(); }
/** * Skip {@code src}'s position forward over one encoded value. * @param src the buffer containing the encoded value. * @return number of bytes skipped. * @throws IllegalArgumentException when the terminator sequence is not found. */ @Override public int skip(PositionedByteRange src) { if (wrapped.isSkippable()) { int ret = wrapped.skip(src); src.setPosition(src.getPosition() + term.length); return ret + term.length; } else { // find the terminator position final int start = src.getPosition(); int skipped = terminatorPosition(src); if (-1 == skipped) throw new IllegalArgumentException("Terminator sequence not found."); skipped += term.length; src.setPosition(skipped); return skipped - start; } }
/** * Skip {@code src}'s position forward over one encoded value. * @param src the buffer containing the encoded value. * @return number of bytes skipped. * @throws IllegalArgumentException when the terminator sequence is not found. */ @Override public int skip(PositionedByteRange src) { if (wrapped.isSkippable()) { int ret = wrapped.skip(src); src.setPosition(src.getPosition() + term.length); return ret + term.length; } else { // find the terminator position final int start = src.getPosition(); int skipped = terminatorPosition(src); if (-1 == skipped) { throw new IllegalArgumentException("Terminator sequence not found."); } skipped += term.length; src.setPosition(skipped); return skipped - start; } }
@Override public T decode(PositionedByteRange src) { if (wrapped.isSkippable()) { T ret = wrapped.decode(src); src.setPosition(src.getPosition() + term.length); return ret; } else { // find the terminator position int term = terminatorPosition(src); if (-1 == term) { throw new IllegalArgumentException("Terminator sequence not found."); } byte[] b = new byte[term - src.getPosition()]; src.get(b); // TODO: should we assert that b.position == b.length? T ret = wrapped.decode(new SimplePositionedMutableByteRange(b)); src.get(this.term); return ret; } }
@Override public T decode(PositionedByteRange src) { if (wrapped.isSkippable()) { T ret = wrapped.decode(src); src.setPosition(src.getPosition() + term.length); return ret; } else { // find the terminator position int term = terminatorPosition(src); if (-1 == term) throw new IllegalArgumentException("Terminator sequence not found."); byte[] b = new byte[term - src.getPosition()]; src.get(b); // TODO: should we assert that b.position == b.length? T ret = wrapped.decode(new SimplePositionedMutableByteRange(b)); src.get(this.term); return ret; } }
@Override public T decode(PositionedByteRange src) { if (wrapped.isSkippable()) { T ret = wrapped.decode(src); src.setPosition(src.getPosition() + term.length); return ret; } else { // find the terminator position int term = terminatorPosition(src); if (-1 == term) { throw new IllegalArgumentException("Terminator sequence not found."); } byte[] b = new byte[term - src.getPosition()]; src.get(b); // TODO: should we assert that b.position == b.length? T ret = wrapped.decode(new SimplePositionedMutableByteRange(b)); src.get(this.term); return ret; } }