@Override public final int skipBytes(int n) throws IOException { if (n < 0) { throw new IllegalArgumentException(); } int toSkip = Math.min(n, remaining()); this.position += toSkip; return toSkip; }
@Override public int read(byte[] b, int off, int len) throws IOException { if(b == null){ throw new NullPointerException("Byte array b cannot be null."); } if(off < 0){ throw new IllegalArgumentException("The offset off cannot be negative."); } if(len < 0){ throw new IllegalArgumentException("The length len cannot be negative."); } int toRead = Math.min(len, remaining()); this.segment.get(this.position,b,off, toRead); this.position += toRead; return toRead; }
int nonSpanningRemaining = this.nonSpanningWrapper.remaining(); return (this.nonSpanningWrapper.remaining() == 0) ? DeserializationResult.LAST_RECORD_FROM_BUFFER : DeserializationResult.INTERMEDIATE_RECORD_FROM_BUFFER; this.spanningWrapper.clear(); return (this.nonSpanningWrapper.remaining() == 0) ? DeserializationResult.LAST_RECORD_FROM_BUFFER : DeserializationResult.INTERMEDIATE_RECORD_FROM_BUFFER;
private void initializeWithPartialLength(NonSpanningWrapper partial) throws IOException { // copy what we have to the length buffer partial.segment.get(partial.position, this.lengthBuffer, partial.remaining()); }
@Override public boolean hasUnfinishedData() { return this.nonSpanningWrapper.remaining() > 0 || this.spanningWrapper.getNumGatheredBytes() > 0; }
private void initializeWithPartialRecord(NonSpanningWrapper partial, int nextRecordLength) throws IOException { // set the length and copy what is available to the buffer this.recordLength = nextRecordLength; this.recordLimit = partial.remaining(); partial.segment.get(this.serializationBuffer, partial.position, partial.remaining()); this.serializationReadBuffer.setBuffer(this.serializationBuffer.wrapAsByteBuffer()); }