Truncate the output. This will empty the list of chunks
@return The list of remaining chunks.
347034
public List<ByteBuffer> releaseRemaining() {
        List<ByteBuffer> ret = buffers;
        buffers = null;
        return ret;
    }
1029833
def _truncateend(self, bits):
        """"""
        assert 0 <= bits <= self.len
        if not bits:
            return
        if bits == self.len:
            self._clear()
            return
        newlength_in_bytes = (self._offset + self.len - bits + 7) // 8
        self._setbytes_unsafe(self._datastore.getbyteslice(0, newlength_in_bytes), self.len - bits,
                              self._offset)
        assert self._assertsanity()
260142
public List<MemorySegment> close() throws IOException
	{
		// send off set last segment
		writeSegment(getCurrentSegment(), getCurrentPositionInSegment(), true);
		clear();
		
		// close the writer and gather all segments
		final LinkedBlockingQueue<MemorySegment> queue = this.writer.getReturnQueue();
		this.writer.close();
		
		// re-collect all memory segments
		ArrayList<MemorySegment> list = new ArrayList<MemorySegment>(this.numSegments);	
		for (int i = 0; i < this.numSegments; i++) {
			final MemorySegment m = queue.poll();
			if (m == null) {
				// we get null if the queue is empty. that should not be the case if the reader was properly closed.
				throw new RuntimeException("ChannelWriterOutputView: MemorySegments have been taken from return queue by different actor.");
			}
			list.add(m);
		}
		
		return list;
	}
648489
public List<WsByteBuffer> finish() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "finish");
        }
        List<WsByteBuffer> list = new LinkedList<WsByteBuffer>();
        if (isFinished()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                Tr.exit(tc, "finish, previously finished");
            }
            return list;
        }
        WsByteBuffer buffer = null;
        this.deflater.finish();
        while (!this.deflater.finished()) {
            int num = this.deflater.deflate(this.buf, 0, this.buf.length);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Compressed amount=" + num + " read=" + this.deflater.getBytesRead() + " written=" + this.deflater.getBytesWritten());
            }
            if (0 < num) {
                buffer = makeBuffer(num);
                list.add(buffer);
            }
        }
        // write the gzip trailer information out
        writeInt((int) this.checksum.getValue(), this.buf, 0);
        writeInt((int) this.deflater.getBytesRead(), this.buf, 4);
        this.deflater.end();
        if (null != buffer && (buffer.capacity() - buffer.limit()) >= 8) {
            buffer.position(buffer.limit());
            buffer.limit(buffer.capacity());
            buffer.put(this.buf, 0, 8);
            buffer.flip();
        } else {
            WsByteBuffer trailer = HttpDispatcher.getBufferManager().allocateDirect(8);
            trailer.put(this.buf, 0, 8);
            trailer.flip();
            list.add(trailer);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "finish, return list of size " + list.size());
        }
        return list;
    }
1344627
public Segment truncate(long index) {
    assertSegmentOpen();
    Assert.index(index >= manager.commitIndex(), "cannot truncate committed index");

    long offset = relativeOffset(index);
    long lastOffset = offsetIndex.lastOffset();

    long diff = Math.abs(lastOffset - offset);
    skip = Math.max(skip - diff, 0);

    if (offset < lastOffset) {
      long position = offsetIndex.truncate(offset);
      buffer.position(position)
        .zero(position)
        .flush();
      termIndex.truncate(offset);
    }
    return this;
  }
1026605
@Override
	public List<MemorySegment> dispose() {
		this.freeMemory.addAll(this.sortIndex);
		this.freeMemory.addAll(this.recordBufferSegments);
		
		this.recordBufferSegments.clear();
		this.sortIndex.clear();
		
		return this.freeMemory;
	}
937103
public int[] mergeChunks() {
        int filledChunks = getFilledChunks();
        int[] merged = new int[size()];
        for (int i = 0; i < filledChunks ; i++) {
            if (chunks[i]!=null) {
                System.arraycopy(chunks[i], 0, merged, i * chunkSize, chunkSize);
            }
        }
        int remainder = size() % chunkSize;
        if (remainder != 0 && chunks[filledChunks]!=null) {
            System.arraycopy(chunks[filledChunks], 0, merged, (filledChunks) * chunkSize, remainder);
        }
        return merged;
    }
162772
private List<Pair<Long, Long>> getTransferSections(CompressionMetadata.Chunk[] chunks)
    {
        List<Pair<Long, Long>> transferSections = new ArrayList<>();
        Pair<Long, Long> lastSection = null;
        for (CompressionMetadata.Chunk chunk : chunks)
        {
            if (lastSection != null)
            {
                if (chunk.offset == lastSection.right)
                {
                    // extend previous section to end of this chunk
                    lastSection = Pair.create(lastSection.left, chunk.offset + chunk.length + 4); // 4 bytes for CRC
                }
                else
                {
                    transferSections.add(lastSection);
                    lastSection = Pair.create(chunk.offset, chunk.offset + chunk.length + 4);
                }
            }
            else
            {
                lastSection = Pair.create(chunk.offset, chunk.offset + chunk.length + 4);
            }
        }
        if (lastSection != null)
            transferSections.add(lastSection);
        return transferSections;
    }
854153
@Override
  public CompletableFuture<Void> truncateTable(TableName tableName, boolean preserveSplits) {
    if (!preserveSplits) {
      LOG.info("truncate will preserveSplits. The passed in variable is ignored.");
    }

    return toCompletableFuture(bigtableTableAdminClient.dropAllRowsAsync(tableName.getNameAsString()));
  }
685743
public void trim()
	{
		List<byte[]> chunkList = mChunkList;
		while (chunkList.size() - 1 > mCurrentChunkIndex)
		{
			chunkList.remove(chunkList.size() - 1);
		}
	}
965011
def truncate(sequence):
    
    if len(sequence) > LIST_SLICE:
        return ", ".join(sequence[:LIST_SLICE] + ["..."])
    else:
        return ", ".join(sequence)
1327716
public void truncate() {
        Log.info("Truncating index");
        try {
            indexWriter.deleteAll();
        } catch (IOException e) {
            Log.error(e, "Error while truncating index");
            throw new RuntimeException(e);
        }
    }
596371
public ColorBuffer truncate(int len) {
    ColorBuffer cbuff = new ColorBuffer(useColor);
    ColorAttr lastAttr = null;
    for (Iterator<Object> i = parts.iterator();
        cbuff.getVisibleLength() < len && i.hasNext();) {
      Object next = i.next();
      if (next instanceof ColorAttr) {
        lastAttr = (ColorAttr) next;
        cbuff.append((ColorAttr) next);
        continue;
      }

      String val = next.toString();
      if (cbuff.getVisibleLength() + val.length() > len) {
        int partLen = len - cbuff.getVisibleLength();
        val = val.substring(0, partLen);
      }

      cbuff.append(val);
    }

    // close off the buffer with a normal tag
    if (lastAttr != null && lastAttr != ColorAttr.NORMAL) {
      cbuff.append(ColorAttr.NORMAL);
    }

    return cbuff;
  }
592468
def purge(self):
        
        def partial_file(item):
            "Filter out partial files"
            #print "???", repr(item)
            return item.completed_chunks < item.size_chunks

        self.cull(file_filter=partial_file, attrs=["get_completed_chunks", "get_size_chunks"])
1339994
public List<ByteBuffer> getBufferList() {
        List<ByteBuffer> result = buffers;
        reset();
        for (ByteBuffer buffer : result) {
            buffer.flip();
        }
        return result;
    }
281371
public List<File> writeSortedChunks(Iterator<T> input) throws IOException {
        List<File> result = new ArrayList<File>();
        while (input.hasNext()) {
            File chunkFile = writeSortedChunk(input);
            result.add(chunkFile);
        }
        if (debugMerge) {
            System.out.printf("Chunks %d (chunkSize=%d, maxOpenFiles=%d)\n", result.size(), config.chunkSize, config.maxOpenFiles);
        }
        return result;
    }
218573
public java.util.List<TerminateRequest> getTerminateWorkspaceRequests() {
        if (terminateWorkspaceRequests == null) {
            terminateWorkspaceRequests = new com.amazonaws.internal.SdkInternalList<TerminateRequest>();
        }
        return terminateWorkspaceRequests;
    }