/** * Copies the given Span into a new Span instance. * * @param spanToCopy the Span to copy. */ public Span(Span spanToCopy) { this(spanToCopy.getFrom(), spanToCopy.getLength()); }
public void write(Span span) { buf.put(Span.ID); if (bytePositions != null) { int byteFrom = bytePositions[span.getFrom()]; int byteLength = bytePositions[span.getFrom() + span.getLength()] - byteFrom; buf.putInt1_2_4Bytes(byteFrom); buf.putInt1_2_4Bytes(byteLength); } else { throw new SerializationException("Cannot serialize Span " + span + ", no access to parent StringFieldValue."); } }
public void write(Span span) { buf.put(Span.ID); if (bytePositions != null) { int byteFrom = bytePositions[span.getFrom()]; int byteLength = bytePositions[span.getFrom() + span.getLength()] - byteFrom; buf.putInt1_2_4Bytes(byteFrom); buf.putInt1_2_4Bytes(byteLength); } else { throw new SerializationException("Cannot serialize Span " + span + ", no access to parent StringFieldValue."); } }
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); }