Writes a single page. This routine assumes that memory has already
    been erased.
331814
def write_page(buf, xfer_offset):
    

    xfer_base = 0x08000000

    # Set mem write address
    set_address(xfer_base+xfer_offset)

    # Send DNLOAD with fw data
    __dev.ctrl_transfer(0x21, __DFU_DNLOAD, 2, __DFU_INTERFACE, buf, __TIMEOUT)

    # Execute last command
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_BUSY:
        raise Exception("DFU: write memory failed")

    # Check command state
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_IDLE:
        raise Exception("DFU: write memory failed")

    if __verbose:
        print ("Write: 0x%x " % (xfer_base + xfer_offset))
482371
def write(self, session, directory, name, replaceParamFile=None, **kwargs):
        
        if self.raster is not None or self.rasterText is not None:
            super(RasterMapFile, self).write(session, directory, name, replaceParamFile, **kwargs)
942777
@Override
  @InService(PageServiceImpl.class)
  void writeImpl(TableKelp table,
                 PageServiceImpl pageServiceImpl,
                 TableWriterService readWrite,
                 SegmentStream sOut,
                 long oldSequence,
                 int saveLength,
                 int saveTail)
  {
    Objects.requireNonNull(sOut);
    
    // System.out.println("WIMPL:" + this + " "+ Long.toHexString(System.identityHashCode(this)) + " " + _stub);
    if (saveLength <= 0
        || oldSequence != sOut.getSequence()
        || _stub == null
        || ! _stub.allowDelta()) {
      PageLeafImpl newPage;
      
      if (! isDirty() 
          && (_blocks.length == 0 || _blocks[0].isCompact())) {
        newPage = copy(getSequence());
      }
      else {
        newPage = compact(table);
      }

      int sequenceWrite = newPage.nextWriteSequence();

      if (! pageServiceImpl.compareAndSetLeaf(this, newPage)
          && ! pageServiceImpl.compareAndSetLeaf(_stub, newPage)) {
        System.out.println("HMPH: " + pageServiceImpl.getPage(getId()) + " " + this + " " + _stub);
      }
      
      saveLength = newPage.getDataLengthWritten();
      
      // newPage.write(db, pageActor, sOut, saveLength);
      
      // oldSequence = newPage.getSequence();
      
      saveTail = newPage.getSaveTail();
      
      newPage.clearDirty();

      readWrite.writePage(newPage, sOut,
                          oldSequence, saveLength, saveTail,
                          sequenceWrite,
                          Result.of(x->newPage.afterDataFlush(pageServiceImpl, sequenceWrite)));
    }
    else {
      int sequenceWrite = nextWriteSequence();
      
      clearDirty();
      
      readWrite.writePage(this, sOut,
                          oldSequence, saveLength, saveTail,
                          sequenceWrite,
                          Result.of(x->afterDataFlush(pageServiceImpl, sequenceWrite)));
    }
  }
371652
protected void expirePage(P page) {
    if(LOG.isDebuggingFine()) {
      LOG.debugFine("Write to backing:" + page.getPageID());
    }
    if (page.isDirty()) {
      file.writePage(page);
    }
  }
834746
private void writeBottom(boolean hasNext) throws IOException {
        String template = Template.readResourceAsStream("com/btaz/util/templates/html-table-footer.ftl");
        Map<String,Object> map = new HashMap<String,Object>();
        String prev = " ";
        String next = "";
        if(currentPageNumber > 1) {
            prev = "<a href=\"" + createFilename(1) + "\">First</a> &nbsp; "
            + "<a href=\"" + createFilename(currentPageNumber-1) + "\">Previous</a> &nbsp; ";
        }
        if(hasNext) {
            next = "<a href=\"" + createFilename(currentPageNumber+1) + "\">Next</a>";
        }
        map.put("pageNavigation", prev + next);
        template = Template.transform(template, map);
        writer.write(template);
        writer.close();
        writer = null;
    }
876174
public void write(int b) throws IOException
    {
        prepareOutput(1);
        if (!_nulled)
            _out.write(b);
        if (_bytes==_contentLength)
            flush();
    }
836840
public void write(byte b[], int off, int len) {
    expandIfNecessary(count + len);
    System.arraycopy(b, off, bytes, count, len);
    count += len;
  }
470012
@Override
  public final synchronized int writePage(P page) {
    int pageid = setPageID(page);
    writePage(pageid, page);
    return pageid;
  }
92365
public void lastPage() {
		int idx = pages.size()-1;
		
		if( idx < 0 ) {
			idx = 0;
		}
		if( pageIndex != idx ) {
			pageIndex = idx;
			currentPage = null;
		}
	}
46117
public boolean newPage() {
        try {
            writeStart(HtmlTags.DIV);
            write(" ");
            write(HtmlTags.STYLE);
            write("=\"");
            writeCssProperty(Markup.CSS_KEY_PAGE_BREAK_BEFORE, Markup.CSS_VALUE_ALWAYS);
            write("\" /");
            os.write(GT);
        }
        catch(IOException ioe) {
            throw new ExceptionConverter(ioe);
        }
        return true;
    }
621188
def __write_byte(self, address, value):
        
        # Save previous address content.
        if address in self._memory:
            self.__memory_prev[address] = self._memory[address]

        self._memory[address] = value & 0xff
165441
def _single_page_pdf(page):
    """"""
    pdf = Pdf.new()
    pdf.pages.append(page)
    bio = BytesIO()
    pdf.save(bio)
    bio.seek(0)
    return bio.read()
585283
public void writeEndPage() throws IOException {
		writer.openElement("document");
		writer.textElement("id", Integer.toString(_page.Id));
		writer.textElement("group", "0");
		writer.textElement("timestamp", formatTimestamp(_rev.Timestamp));
		writer.textElement("title", _page.Title.toString());
		writer.textElement("body", _rev.Text);
		writer.closeElement();
		_rev = null;
		_page = null;
	}
201776
def memory_write(self, start_position: int, size: int, value: bytes) -> None:
        
        return self._memory.write(start_position, size, value)
897371
@InService(SegmentServiceImpl.class)
  public
  Page writePage(Page page,
                 long oldSequence,
                 int saveLength,
                 int saveTail,
                 int saveSequence,
                 Result<Integer> result)
  {
    if (isClosed()) {
      return null;
    }
    
    // Type type = page.getType();
    int pid = page.getId();
    int nextPid = page.getNextId();
    
    WriteStream out = out();
    
    int head = (int) out.position();
    
    try {
      int available = getAvailable();
      
      if (available < head + page.size()) {
        return null;
      }
      
      Page newPage = page.writeCheckpoint(_table, this, oldSequence,
                                          saveLength, saveTail, saveSequence);

      if (newPage == null) {
        return null;
      }
      
      newPage.setSequence(getSequence());
      
      out = out();
      
      int tail = (int) out.position();

      if (addIndex(out, page, newPage,
                   saveSequence, newPage.getLastWriteType(), 
                   pid, nextPid, head, tail - head,
                   result)) {
        return newPage;
      }
      else {
        return null;
      }
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }
65710
@Override
	public void write(byte data[], int offset, int len) throws IOException
    {
        if ((capacity - size) < len)
            flush();
        
        // Do we have enough space ?
        if (capacity >= len)
        {
            System.arraycopy(data, offset, buffer, size, len);
            size += len;
        }
        else
        {
            // Too big, write it directly ...
            out.write(data, offset, len);
        }
    }
30240
def write(self, data):
        
        if not isinstance(data, (bytes, bytearray, memoryview)):
            raise TypeError('data argument must be byte-ish (%r)',
                            type(data))

        if not self._state.is_writable or self._closing:
            raise self._invalid_state("write() called")

        if not data:
            return

        if not self._buffer:
            self._loop.add_writer(self._raw_fd, self._write_ready)

        self._buffer.extend(data)