Write Connections to File Method
185852
def _writeConnections(self, connections, fileObject):
        
        for connection in connections:
            fileObject.write('CONNECT  %s  %s  %s\n' % (
                connection.slinkNumber,
                connection.upSjuncNumber,
                connection.downSjuncNumber))
782249
private static void writeFile(CyclicBarrier barrier, AtomicLong runtime, int count,
      AlluxioConfiguration alluxioConf)
      throws Exception {
    FileSystem fileSystem = FileSystem.Factory.create(alluxioConf);
    byte[] buffer = new byte[(int) Math.min(sFileSize, 4 * Constants.MB)];
    Arrays.fill(buffer, (byte) 'a');
    AlluxioURI path = filename(count);

    if (fileSystem.exists(path)) {
      fileSystem.delete(path);
    }

    barrier.await();
    long startTime = System.nanoTime();
    long bytesWritten = 0;
    try (FileOutStream outStream = fileSystem.createFile(path)) {
      while (bytesWritten < sFileSize) {
        outStream.write(buffer, 0, (int) Math.min(buffer.length, sFileSize - bytesWritten));
        bytesWritten += buffer.length;
      }
    }
    runtime.addAndGet(System.nanoTime() - startTime);
  }
1204140
function write(socket, task, id, fn) {
  session[binary ? 'binary' : 'utf8'](task.size, function message(err, data) {
    var start = socket.last = Date.now();

    socket.send(data, {
      binary: binary,
      mask: masked
    }, function sending(err) {
      if (err) {
        process.send({ type: 'error', message: err.message, concurrent: --concurrent, id: id });

        socket.close();
        delete connections[id];
      }

      if (fn) fn(err);
    });
  });
}
248448
private void writeConnection(Definition def, Writer out, int indent) throws IOException
   {
      writeWithIndent(out, indent, "/** \n");
      writeWithIndent(out, indent, " * Get connection from factory\n");
      writeWithIndent(out, indent, " *\n");
      writeWithIndent(out, indent,
            " * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n");
      writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() +
            " getConnection() throws ResourceException;\n");
   }
87418
public static void writeConfigFile(String fileName, Class<?>[] classes) throws SQLException, IOException {
		writeConfigFile(fileName, classes, false);
	}
1087978
public void connect() throws IOException {
        if (this.connected) {
            return;
        }
        
        this.downloadFile = File.createTempFile(CLASSNAME, null, TMPDIR);
        try {
            String [] cmd = getCommand(this.url, this.downloadFile);    
            if (LOGGER.isLoggable(Level.FINE)) {
                StringBuffer buffer = new StringBuffer();
                for (int i = 0; i < cmd.length; i++) {
                    if (i > 0) {
                        buffer.append(" ");
                    }
                    buffer.append(cmd[i]);
                }
                LOGGER.fine("Command: " + buffer.toString());
            }
            ProcessResult pr = ProcessUtils.exec(cmd);
            if (pr.getResult() != 0) {
                LOGGER.info(Arrays.toString(cmd) + " returned non-null " + pr.getResult());
            }
            // Assume download went smoothly.
            this.connected = true;
        } catch (IOException ioe) {
            // Clean up my tmp file.
            this.downloadFile.delete();
            this.downloadFile = null;
            // Rethrow.
            throw ioe;
        }
    }
1172458
def write_to_remote(self, filepath_from, filepath_to, mtime_dt=None):
        """"""

        self.__log.debug("Writing L[%s] -> R[%s]." % (filepath_from, 
                                                      filepath_to))

        with open(filepath_from, 'rb') as file_from:
            with SftpFile(self, filepath_to, 'w') as sf_to:
                while 1:
                    part = file_from.read(MAX_MIRROR_WRITE_CHUNK_SIZE)
                    sf_to.write(part)

                    if len(part) < MAX_MIRROR_WRITE_CHUNK_SIZE:
                        break

        if mtime_dt is None:
            mtime_dt = datetime.now()

        self.utimes_dt(filepath_to, mtime_dt, mtime_dt)
263946
@Override
    public long write(long numBytes, int time) throws IOException {
        int timeout = time;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "write(" + numBytes + "," + timeout + ")");
        }
        getTCPConnLink().incrementNumWrites();
        if (getConfig().getDumpStatsInterval() > 0) {
            getTCPConnLink().getTCPChannel().totalSyncWrites.incrementAndGet();
        }
        // always check external call parms
        checkForErrors(numBytes, false, timeout);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Socket socket = getTCPConnLink().getSocketIOChannel().getSocket();
            Tr.event(tc, "write (sync) requested for local: " + socket.getLocalSocketAddress() + " remote: " + socket.getRemoteSocketAddress());
        }

        long numUserBytesWritten = 0L; // no. of user bytes written

        if (isAborted()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Previously aborted, unable to perform write");
            }
            throw new IOException("Connection aborted by program");
        }

        if (timeout == IMMED_TIMEOUT) {
            immediateTimeout();
        } else if (timeout == ABORT_TIMEOUT) {
            abort();
            immediateTimeout();
        } else {
            // if using channel timeout, reset to that value
            if (timeout == TCPRequestContext.USE_CHANNEL_TIMEOUT) {
                timeout = getConfig().getInactivityTimeout();
            }
            // check if this is a FileChannel write request
            if (isFileChannelWriteToBeDone()) {
                numUserBytesWritten = fileChannelWrite(numBytes, timeout);
            } else {
                numUserBytesWritten = processSyncWriteRequest(numBytes, timeout);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "write(sync): " + numUserBytesWritten);
        }
        return (numUserBytesWritten);
    }
1327539
public void write(FileChannel fileChannel) throws java.io.IOException
  {
    ((HttpOutputStream) _conn).writeFile(fileChannel);
  }
665781
def write_array(self, data):
        """"""
        try:
            data.tofile(self._fh)
        except Exception:
            # BytesIO
            self._fh.write(data.tostring())
1045785
public static void writeToFile(String str, String fileName, Charset charset) throws Exception {
    OutputStreamWriter writer = null;
    if (null == charset) {
      writer = new OutputStreamWriter(new FileOutputStream(fileName));
    } else {
      writer = new OutputStreamWriter(new FileOutputStream(fileName), charset.name());
    }
    writer.write(str);
    writer.close();
  }
11674
def Write(self, outpath):
    ""
    out = zipfile.ZipFile(outpath, mode="w", compression=zipfile.ZIP_DEFLATED)
    for filename, func in [('agency.txt', self.WriteAgency),
                           ('calendar.txt', self.WriteCalendar),
                           ('calendar_dates.txt', self.WriteCalendarDates),
                           ('routes.txt', self.WriteRoutes),
                           ('trips.txt', self.WriteTrips),
                           ('stops.txt', self.WriteStations),
                           ('stop_times.txt', self.WriteStopTimes)]:
      s = cStringIO.StringIO()
      func(s)
      out.writestr(filename, s.getvalue())
    out.close()
431917
function writeFiles (files, callback) {
  async.map(files, writeFile.bind(this), function (err) {
    if (err) callback(err);
    callback(null);
  });
}
63970
protected void writeRow(Session session, Table t,
                            Object[] data) throws IOException {

        rowOut.reset();
        rowOut.writeRow(data, t.getColumnTypes());
        fileStreamOut.write(rowOut.getOutputStream().getBuffer(), 0,
                            rowOut.size());

        tableRowCount++;
    }
692392
def write_to_file(chats, chatfile):
    """"""
    with open(chatfile, 'w') as handler:
        handler.write('\n'.join((str(id_) for id_ in chats)))
803771
private void writeOutbound(Definition def, Writer out, int indent) throws IOException
   {
      writeIndent(out, indent);
      out.write("<managedconnectionfactory-class>" + def.getRaPackage() + "." +
            def.getMcfDefs().get(0).getMcfClass() + "</managedconnectionfactory-class>");
      writeEol(out);
      writeEol(out);

      if (!def.getMcfDefs().get(0).isUseCciConnection())
      {
         writeIndent(out, indent);
         out.write("<connectionfactory-interface>" + def.getRaPackage() + "." +
               def.getMcfDefs().get(0).getCfInterfaceClass() + "</connectionfactory-interface>");
         writeEol(out);
         writeIndent(out, indent);
         out.write("<connectionfactory-impl-class>" + def.getRaPackage() + "." +
               def.getMcfDefs().get(0).getCfClass() + "</connectionfactory-impl-class>");
         writeEol(out);
         writeIndent(out, indent);
         out.write("<connection-interface>" + def.getRaPackage() + "." +
               def.getMcfDefs().get(0).getConnInterfaceClass() + "</connection-interface>");
         writeEol(out);
         writeIndent(out, indent);
         out.write("<connection-impl-class>" + def.getRaPackage() + "." +
               def.getMcfDefs().get(0).getConnImplClass() + "</connection-impl-class>");
         writeEol(out);
      }
      else
      {
         writeIndent(out, indent);
         out.write("<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>");
         writeEol(out);
         writeIndent(out, indent);
         out.write("<connectionfactory-impl-class>" + def.getRaPackage() + "." +
               def.getMcfDefs().get(0).getCciConnFactoryClass() + "</connectionfactory-impl-class>");
         writeEol(out);
         writeIndent(out, indent);
         out.write("<connection-interface>javax.resource.cci.Connection</connection-interface>");
         writeEol(out);
         writeIndent(out, indent);
         out.write("<connection-impl-class>" + def.getRaPackage() + "." +
               def.getMcfDefs().get(0).getCciConnClass() + "</connection-impl-class>");
         writeEol(out);
      }

      writeEol(out);
      writeIndent(out, indent);
      out.write("<transaction-support>" + def.getSupportTransaction() + "</transaction-support>");
      writeEol(out);

      writeConfigPropsXml(def.getMcfDefs().get(0).getMcfConfigProps(), out, indent);

      writeIndent(out, indent);
      out.write("<reauthentication-support>" + def.isSupportReauthen() + "</reauthentication-support>");
      writeEol(out);
   }
407162
def write(self, node, filehandle):
        """"""
        dictexporter = self.dictexporter or DictExporter()
        data = dictexporter.export(node)
        return json.dump(data, filehandle, **self.kwargs)