/** * This will construct a valid span or throw {@link IllegalArgumentException} * if the span is invalid. * * @param from Start of the span. Must be >= 0. * @param length of the span. Must be >= 0. * @throws IllegalArgumentException if illegal span */ public Span(int from, int length) { setFrom(from); setLength(length); }
private void correctIndexes(Span span) { if (stringPositions == null) { throw new DeserializationException("Cannot deserialize Span, no access to parent StringFieldValue."); } int fromIndex = stringPositions[span.getFrom()]; int toIndex = stringPositions[span.getTo()]; int length = toIndex - fromIndex; span.setFrom(fromIndex); span.setLength(length); }
private void correctIndexes(Span span) { if (stringPositions == null) { throw new DeserializationException("Cannot deserialize Span, no access to parent StringFieldValue."); } int fromIndex = stringPositions[span.getFrom()]; int toIndex = stringPositions[span.getTo()]; int length = toIndex - fromIndex; span.setFrom(fromIndex); span.setLength(length); }
public void read(Span span) { byte type = buf.get(); if ((type & Span.ID) != Span.ID) { throw new DeserializationException("Cannot deserialize Span with type " + type); } span.setFrom(buf.getInt1_2_4Bytes()); span.setLength(buf.getInt1_2_4Bytes()); }
public void read(Span span) { byte type = buf.get(); if ((type & Span.ID) != Span.ID) { throw new DeserializationException("Cannot deserialize Span with type " + type); } span.setFrom(buf.getInt1_2_4Bytes()); span.setLength(buf.getInt1_2_4Bytes()); }