Writes this {@link StatsSnapshot} to the provided {@link BufferedSink}.
185963
public void dump(@NonNull BufferedSink sink) throws IOException {
    sink.writeUtf8("===============BEGIN PICASSO STATS ===============");
    sink.writeUtf8("\n");
    sink.writeUtf8("Memory Cache Stats");
    sink.writeUtf8("\n");
    sink.writeUtf8("  Max Cache Size: ");
    sink.writeUtf8(Integer.toString(maxSize));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Cache Size: ");
    sink.writeUtf8(Integer.toString(size));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Cache % Full: ");
    sink.writeUtf8(Integer.toString((int) Math.ceil((float) size / maxSize * 100)));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Cache Hits: ");
    sink.writeUtf8(Long.toString(cacheHits));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Cache Misses: ");
    sink.writeUtf8(Long.toString(cacheMisses));
    sink.writeUtf8("\n");
    sink.writeUtf8("Network Stats");
    sink.writeUtf8("\n");
    sink.writeUtf8("  Download Count: ");
    sink.writeUtf8(Integer.toString(downloadCount));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Total Download Size: ");
    sink.writeUtf8(Long.toString(totalDownloadSize));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Average Download Size: ");
    sink.writeUtf8(Long.toString(averageDownloadSize));
    sink.writeUtf8("\n");
    sink.writeUtf8("Bitmap Stats");
    sink.writeUtf8("\n");
    sink.writeUtf8("  Total Bitmaps Decoded: ");
    sink.writeUtf8(Integer.toString(originalBitmapCount));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Total Bitmap Size: ");
    sink.writeUtf8(Long.toString(totalOriginalBitmapSize));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Total Transformed Bitmaps: ");
    sink.writeUtf8(Integer.toString(transformedBitmapCount));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Total Transformed Bitmap Size: ");
    sink.writeUtf8(Long.toString(totalTransformedBitmapSize));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Average Bitmap Size: ");
    sink.writeUtf8(Long.toString(averageOriginalBitmapSize));
    sink.writeUtf8("\n");
    sink.writeUtf8("  Average Transformed Bitmap Size: ");
    sink.writeUtf8(Long.toString(averageTransformedBitmapSize));
    sink.writeUtf8("\n");
    sink.writeUtf8("===============END PICASSO STATS ===============");
    sink.writeUtf8("\n");
  }
567329
private void writeObject(java.io.ObjectOutputStream s)
        throws java.io.IOException {

        // Write out any hidden stuff
        s.defaultWriteObject();

        // Write out all elements in the proper order.
        for (Node<E> p = first(); p != null; p = succ(p)) {
            final E item;
            if ((item = p.item) != null)
                s.writeObject(item);
        }

        // Use trailing null as sentinel
        s.writeObject(null);
    }
686573
SnapshotDescriptor copyTo(Buffer buffer) {
    this.buffer = buffer
        .writeLong(index)
        .writeLong(timestamp)
        .writeInt(version)
        .writeBoolean(locked)
        .skip(BYTES - buffer.position())
        .flush();
    return this;
  }
1178422
public boolean takeSnapshot(OutputStream out) throws IOException {
    TransactionSnapshot snapshot = getSnapshot();
    if (snapshot != null) {
      persistor.writeSnapshot(out, snapshot);
      return true;
    } else {
      return false;
    }
  }
1245857
private void writeBufferToFile() throws IOException {
        if (_bufferOffset > 0) {
            List<ByteBuffer> payload = new ArrayList<ByteBuffer>(1);
            payload.add(ByteBuffer.wrap(_buffer, 0, _bufferOffset));
            NfsWriteResponse response = _nfsFile.write(_currentOffset, payload, _syncType);
            int bytesWritten = response.getCount();
            _currentOffset += bytesWritten;
            _bufferOffset -= bytesWritten;
            if (0 != _bufferOffset) { // Everything was not written.
                // _bufferOffset should be the number of unwritten bytes.
                // Copy the unwritten bytes to the beginning of the buffer.
                System.arraycopy(_buffer, bytesWritten, _buffer, 0, _bufferOffset);
            }
        }
    }
208830
private static StatSnapshot createStatSnapshot(IStats stat, String intervalName, List<String> valueNames){
		StatSnapshot snapshot = new StatSnapshot(stat.getName());

		for (String valueName : valueNames){
			snapshot.setValue(valueName, stat.getValueByNameAsString(valueName, intervalName, TimeUnit.NANOSECONDS));
		}


		return snapshot;


	}
28612
@Override
  public void write(byte []buf, int offset, int length, boolean isEnd)
    throws IOException
  {
    while (length > 0) {
      if (_tail == null) {
        addBuffer(TempBuffer.create());
      }
      else if (_tail.buffer().length <= _tail.length()) {
        addBuffer(TempBuffer.create());
      }
      
      TempBuffer tail = _tail;

      int sublen = Math.min(length, tail.buffer().length - tail.length());

      System.arraycopy(buf, offset, tail.buffer(), tail.length(), sublen);

      length -= sublen;
      offset += sublen;
      _tail.length(_tail.length() + sublen);
    }
  }
129936
public static Runnable writeSnapshotCatalog(String path, String nonce, boolean isTruncationSnapshot)
    throws IOException
    {
        String filename = SnapshotUtil.constructCatalogFilenameForNonce(nonce);
        try
        {
            return VoltDB.instance().getCatalogContext().writeCatalogJarToFile(path, filename,
                    CatalogJarWriteMode.RECOVER);
        }
        catch (IOException ioe)
        {
            if (isTruncationSnapshot) {
                VoltDB.crashLocalVoltDB("Unexpected exception while attempting to create Catalog file for truncation snapshot",
                        true, ioe);
            }
            throw new IOException("Unable to write snapshot catalog to file: " +
                                  path + File.separator + filename, ioe);
        }
    }
513923
def write(self, s: str) -> None:
        """"""
        if not isinstance(s, str):
            raise TypeError('write() argument must be str, not {}'.format(type(s)))

        if not self.pause_storage:
            self.buffer.byte_buf += s.encode(encoding=self.encoding, errors=self.errors)
        if self.echo:
            self.inner_stream.write(s)
859470
public void write() {
    // We record the start time to avoid spending too much time on writings
    long startOfCycle = System.nanoTime();
    long bytesWritten = 0;

    long nPacketsWritten = 0;

    while ((System.nanoTime() - startOfCycle - writeBatchTime.toNanos()) < 0
        && (bytesWritten < writeBatchSize.asBytes())) {
      OutgoingPacket outgoingPacket = outgoingPacketsToWrite.peek();
      if (outgoingPacket == null) {
        break;
      }

      int writeState = outgoingPacket.writeToChannel(socketChannel);
      if (writeState > 0) {
        // Partial writing, we would break since we could not write more data on socket.
        // But we have set the next start point of OutgoingPacket
        // Next time when the socket is writable, it will start from that point.
        break;
      } else if (writeState < 0) {
        LOG.severe("Something bad happened while writing to channel");
        selectHandler.handleError(socketChannel);
        return;
      } else {
        // writeState == 0, we fully write a outgoingPacket
        bytesWritten += outgoingPacket.size();
        nPacketsWritten++;

        outgoingPacketsToWrite.remove();
      }
    }

    totalPacketsWritten += nPacketsWritten;
    totalBytesWritten += bytesWritten;

    // Disable writing if there are nothing to send in buffer
    if (getOutstandingPackets() == 0) {
      disableWriting();
    }
  }
1161512
public void write(ByteBuffer buffer, int len) {
        if (len < 1) return;
        if (count >= content.length - len) {
            byte[] ns = new byte[content.length + len];
            System.arraycopy(content, 0, ns, 0, count);
            this.content = ns;
        }
        buffer.get(content, count, len);
        count += len;
    }
561553
public void takeSnapshot(SnapshotWriter writer) {
    log.debug("Taking snapshot {}", writer.snapshot().index());

    // Serialize sessions to the in-memory snapshot and request a snapshot from the state machine.
    writer.writeLong(primitiveId.id());
    writer.writeString(primitiveType.name());
    writer.writeString(serviceName);
    writer.writeLong(currentIndex);
    writer.writeLong(currentTimestamp);
    writer.writeLong(timestampDelta);

    writer.writeInt(sessions.getSessions().size());
    for (RaftSession session : sessions.getSessions()) {
      writer.writeLong(session.sessionId().id());
      writer.writeString(session.memberId().id());
      writer.writeString(session.readConsistency().name());
      writer.writeLong(session.minTimeout());
      writer.writeLong(session.maxTimeout());
      writer.writeLong(session.getLastUpdated());
      writer.writeLong(session.getRequestSequence());
      writer.writeLong(session.getCommandSequence());
      writer.writeLong(session.getEventIndex());
      writer.writeLong(session.getLastCompleted());
    }
    service.backup(new DefaultBackupOutput(writer, service.serializer()));
  }
868064
@Override
  public void write(byte[] b, int start, int length) throws IOException {
    currentDataSegmentBuffer.write(b, start, length);
    flushIfNeeded();
  }
1078643
public void writeTo(Segment sink, int byteCount) {
    if (!sink.owner) throw new IllegalArgumentException();
    if (sink.limit + byteCount > SIZE) {
      // We can't fit byteCount bytes at the sink's current position. Shift sink first.
      if (sink.shared) throw new IllegalArgumentException();
      if (sink.limit + byteCount - sink.pos > SIZE) throw new IllegalArgumentException();
      System.arraycopy(sink.data, sink.pos, sink.data, 0, sink.limit - sink.pos);
      sink.limit -= sink.pos;
      sink.pos = 0;
    }

    System.arraycopy(data, pos, sink.data, sink.limit, byteCount);
    sink.limit += byteCount;
    pos += byteCount;
  }
42199
@Override
  void writeJournal(OutputStream os, 
                    byte[] buffer, int offset,
                    BlobOutputStream blob)
    throws IOException
  {
    if (blob == null) {
      BitsUtil.writeInt16(os, 0);
      return;
    }

    if (blob.isLargeBlob()) {
      blob.flushBlob();
      
      BitsUtil.writeInt16(os, LARGE_BLOB_MASK | 4);
      BitsUtil.writeInt(os, blob.getBlobId());
      return;
    }
    
    int len = blob.getSize();
    
    if (len >= 32 * 1024) {
      throw new IllegalStateException("TOO_BIG: " + len);
    }
    
    BitsUtil.writeInt16(os, len);
    
    blob.writeToStream(os);
  }
496478
protected void storeSnapshotProps(String spaceId, String serializedProps) {
        InputStream propsStream;
        try {
            propsStream = IOUtil.writeStringToStream(serializedProps);
        } catch (IOException e) {
            throw new TaskException("Unable to build stream from serialized " +
                                    "snapshot properties due to: " +
                                    e.getMessage());
        }
        ChecksumUtil checksumUtil = new ChecksumUtil(ChecksumUtil.Algorithm.MD5);
        String propsChecksum = checksumUtil.generateChecksum(serializedProps);

        snapshotProvider.addContent(spaceId,
                                    Constants.SNAPSHOT_PROPS_FILENAME,
                                    "text/x-java-properties",
                                    null,
                                    // Ensures that length is based on UTF-8 encoded bytes
                                    serializedProps.getBytes(StandardCharsets.UTF_8).length,
                                    propsChecksum,
                                    propsStream);
    }
750134
@Override
    public IoBufferEx write(IoBufferEx source, IoBufferAllocatorEx<?> allocator) {
        return writeChunked(source, allocator);
    }