Creates a new output file and writes the header information.

@throws ConfigurationException
if an error occurred while accessing the configuration
@throws IOException
if an error occurred while writing a file
16230
protected void writeHeader()
		throws ConfigurationException, IOException
	{

		if (this.output != null) {
			close();
		}

		this.counter++;

		String filePath = PATH_OUTPUT_SQL_FILES + this.outputName +"_"+counter;

		this.output = OutputFactory.getOutputStream(filePath);

		// System.out.println(filePath);
		SQLConsumerLogMessages.logFileCreation(logger, filePath);

		this.sqlArchive = new File(filePath);

		String[] revTable = this.sqlEncoder.getTable();
		for (String sTable : revTable) {
			String curLine = sTable + "\r\n";
			byte[] bytes = curLine.getBytes(WIKIPEDIA_ENCODING);
			this.output.write(bytes);
		}

		this.output.flush();
	}
330516
public static void writeConfigFile(OutputStream outputStream, Class<?>[] classes) throws SQLException, IOException {
		writeConfigFile(outputStream, classes, false);
	}
602494
public void write(DataOutput out) throws IOException {
    UTF8.writeString(out, file);
    out.writeLong(start);
    out.writeLong(length);
  }
999582
private static void writeHeader(Path file) throws IOException {
        try (FileChannel fout = FileChannel.open(file, StandardOpenOption.WRITE)) {

            long size = fout.size();
            int sampleSize = (int) size - 44;

            if (logger.isInfoEnabled()) {
                logger.info("Size  " + sampleSize + " of recording file " + file);
            }

            ByteBuffer headerBuffer = ByteBuffer.allocateDirect(44);
            headerBuffer.clear();
            // RIFF
            headerBuffer.put((byte) 0x52);
            headerBuffer.put((byte) 0x49);
            headerBuffer.put((byte) 0x46);
            headerBuffer.put((byte) 0x46);

            int length = sampleSize + 36;

            // Length
            headerBuffer.put((byte) (length));
            headerBuffer.put((byte) (length >> 8));
            headerBuffer.put((byte) (length >> 16));
            headerBuffer.put((byte) (length >> 24));

            // WAVE
            headerBuffer.put((byte) 0x57);
            headerBuffer.put((byte) 0x41);
            headerBuffer.put((byte) 0x56);
            headerBuffer.put((byte) 0x45);

            // fmt
            headerBuffer.put((byte) 0x66);
            headerBuffer.put((byte) 0x6d);
            headerBuffer.put((byte) 0x74);
            headerBuffer.put((byte) 0x20);

            headerBuffer.put((byte) 0x10);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);

            // format - PCM
            headerBuffer.put((byte) 0x01);
            headerBuffer.put((byte) 0x00);

            // format - MONO
            headerBuffer.put((byte) 0x01);
            headerBuffer.put((byte) 0x00);

            // sample rate:8000
            headerBuffer.put((byte) 0x40);
            headerBuffer.put((byte) 0x1F);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);

            // byte rate
            headerBuffer.put((byte) 0x80);
            headerBuffer.put((byte) 0x3E);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);

            // Block align
            headerBuffer.put((byte) 0x02);
            headerBuffer.put((byte) 0x00);

            // Bits per sample: 16
            headerBuffer.put((byte) 0x10);
            headerBuffer.put((byte) 0x00);

            // "data"
            headerBuffer.put((byte) 0x64);
            headerBuffer.put((byte) 0x61);
            headerBuffer.put((byte) 0x74);
            headerBuffer.put((byte) 0x61);

            // len
            headerBuffer.put((byte) (sampleSize));
            headerBuffer.put((byte) (sampleSize >> 8));
            headerBuffer.put((byte) (sampleSize >> 16));
            headerBuffer.put((byte) (sampleSize >> 24));

            headerBuffer.rewind();

            // lets write header
            fout.position(0);
            fout.write(headerBuffer);
        }
    }
906233
public void write() throws IOException
   {
      SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
      {
         public Object run() throws Exception
         {
            // do not write if not dirty
            if (!dirty)
            {
               return null;
            }

            OutputStream out = new IndexOutputStream(dir.createOutput(name + ".new"));
            DataOutputStream dataOut = null;
            try
            {
               dataOut = new DataOutputStream(out);
               dataOut.writeInt(counter);
               dataOut.writeInt(indexes.size());
               for (int i = 0; i < indexes.size(); i++)
               {
                  dataOut.writeUTF(getName(i));
               }
            }
            finally
            {
               if (dataOut != null)
                  dataOut.close();
               out.close();
            }
            // delete old
            if (dir.fileExists(name))
            {
               dir.deleteFile(name);
            }
            rename(name + ".new", name);
            dirty = false;
            return null;
         }
      });
   }
704148
public boolean createNewFile() throws IOException
  {
    synchronized (LOCK) {
      if (! exists()) {
        clearStatusCache();
        WriteStreamOld s = openWrite();
        s.close();
        return true;
      }
    }

    return false;
  }
108744
@Override
  public void create()
    throws IOException
  {
    Files.createDirectories(_path.getParent());

    if (Files.exists(_path)) {
      throw new IOException(L.l("CREATE for path '{0}' failed, because the file already exists.  CREATE can not override an existing table.",
                                _path));
    }
    
    init();
    /*
    _channel = _path.openFileChannel(StandardOpenOption.CREATE, 
                                     StandardOpenOption.WRITE,
                                     StandardOpenOption.READ);
    
    setFileSize(_path.length());
    
    initImpl();
    */
  }
567291
private void writeTop() throws IOException {
        // setup output HTML file
        File outputFile = new File(outputDirectory, createFilename(currentPageNumber));
        writer = new BufferedWriter(new OutputStreamWriter(
                new FileOutputStream(outputFile, false), Charset.forName(encoding)));

        // write header
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("pageTitle", pageTitle);
        if(pageHeader != null && pageHeader.length() > 0) {
            map.put("header", "<h1>" + pageHeader + "</h1>");
        } else {
            map.put("header","");
        }
        if(pageDescription != null && pageDescription.length() > 0) {
            map.put("description", "<p>" + pageDescription + "</p>");
        } else {
            map.put("description", "");
        }

        String template = Template.readResourceAsStream("com/btaz/util/templates/html-table-header.ftl");
        String output = Template.transform(template, map);
        writer.write(output);
    }
1351991
public OutputStream write() throws IOException {
        if(gz.exists())
            gz.delete();
        try {
            return Files.newOutputStream(file.toPath());
        } catch (InvalidPathException e) {
            throw new IOException(e);
        }
    }
950513
private void writeConf() throws IOException {
    for (int i = 0; i < mNumMasters; i++) {
      File confDir = new File(mWorkDir, "conf-master" + i);
      writeConfToFile(confDir, mMasterProperties.getOrDefault(i, new HashMap<>()));
    }
    for (int i = 0; i < mNumWorkers; i++) {
      File confDir = new File(mWorkDir, "conf-worker" + i);
      writeConfToFile(confDir, mWorkerProperties.getOrDefault(i, new HashMap<>()));
    }
  }
1201535
private void writeObject(ObjectOutputStream out) throws IOException {
		super.write(out);
		out.writeUTF(this.mapreduceInputFormat.getClass().getName());
		out.writeUTF(this.keyClass.getName());
		out.writeUTF(this.valueClass.getName());
		this.configuration.write(out);
	}
1265577
public void write(File file) throws IOException {
        try (InputStream inputStream = getInputStream()) {
            IoUtils.copy(inputStream, file);
        }
    }
1131747
private void makeNewFile() throws IOException {
		String filename=prefix+(files.size()+1)+suffix;
		File file=new File(parent, filename);
		out=new FileOutputStream(file);
		bytesOut=0;
		files.add(file);
	}
1224217
protected static FlushableDataOutput writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException {
        final FlushableDataOutput output = FlushableDataOutputImpl.create(os);
        header.write(output);
        return output;
    }
14871
def write_file(self):
        ''''''
        if self.config:
            try:
                with open(self.config_file, 'w') as file:
                    json.dump(self.config, file)
            except IOError as error:
                print('Error:', error)
                return
912269
public void write() throws IOException {
		{
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + postfix;
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeGen(fileObject, jsonModel);
		}
		if (jsonModel.isBuilder()) {
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + "JsonMeta";
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeJsonMeta(fileObject, jsonModel);
		}
	}
1183428
private void writeFile()
            throws IOException
    {
        LOGGER.debug( "Writing credentials file to {}", file );
        File tempFile = new File( file.getPath() + ".tmp" );

        Writer writer = null;
        try {
            writer = new OutputStreamWriter( new FileOutputStream( tempFile ), PcsUtils.UTF8 );

            for ( String key : credentialsMap.keySet() ) {
                Credentials cred = credentialsMap.get( key );
                final String line = key + "=" + cred.toJson() + "\n";
                writer.write( line );
            }
            writer.flush();

        } finally {
            PcsUtils.closeQuietly( writer );
        }

        file.delete();
        tempFile.renameTo( file );
    }