Saves a matrix to disk using Java binary serialization.

@param A The matrix being saved.
@param fileName Name of the file its being saved at.
@throws java.io.IOException
501350
public static void saveBin(DMatrix A, String fileName)
        throws IOException
    {
        FileOutputStream fileStream = new FileOutputStream(fileName);
        ObjectOutputStream stream = new ObjectOutputStream(fileStream);

        try {
            stream.writeObject(A);
            stream.flush();
        } finally {
            // clean up
            try {
                stream.close();
            } finally {
                fileStream.close();
            }
        }

    }
876006
public void decompose( DMatrixRMaj A ) {
        init(A);

        for( int k = 1; k < N; k++ ) {
            similarTransform(k);
//            System.out.println("k=="+k);
//            QT.print();
        }
    }
1348286
private void writeName(DataOutputStream os, MLArray array) throws IOException
    {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        DataOutputStream bufferDOS = new DataOutputStream(buffer);

        byte[] nameByteArray = array.getNameToByteArray();
        buffer = new ByteArrayOutputStream();
        bufferDOS = new DataOutputStream(buffer);
        bufferDOS.write( nameByteArray );
        OSArrayTag tag = new OSArrayTag(MatDataTypes.miINT8, buffer.toByteArray() );
        tag.writeTo( os );
    }
92094
public void save(File file) throws IOException {

        Writer writer = null;

        try {
            writer = new Writer(file);
            writer.println(toPrettyString());
        } finally {
            if (writer != null) writer.close();
        }
    }
429690
public void append(final byte[] a)
	{
		if(a == null) throw new NullPointerException();
		if(a.length == 0) return;
		
		if(a.length <= 8) {
			write(a, 0, a.length);		
		} else
		if((a.length <= 16) && (pos > 0) && ((buffer.length - pos) > a.length)) {
			write(a, 0, a.length);
		} else {
			flushBuffer();
			arrays.add(a);
			size += a.length;
		}
	}
581089
def save_data(self, filename):
        
        with zopen(filename, "wt") as f:
            json.dump(list(self._data), f, cls=MontyEncoder)
1338192
public void save(File file) throws IOException {
        try (FileOutputStream out = new FileOutputStream(file)) {
            save(out);
        }
    }
796104
public String saveAs(String streamKey, String fileName) throws QiniuException {
        return saveAs(streamKey, fileName, 0, 0);
    }
559734
public void ENsaveinpfile( String fileName ) throws EpanetException {
        int err = epanet.ENsaveinpfile(fileName);
        checkError(err);
    }
14309
protected final void writeblob(String filename, byte[] blob) throws IOException {
    ZipEntry archiveEntry = new ZipEntry(targetdir + filename);
    archiveEntry.setSize(blob.length);
    zos.putNextEntry(archiveEntry);
    zos.write(blob);
    zos.closeEntry();
  }
911023
private synchronized void saveFile(String fileContent, File fileName) {
        try {
            if (imports.getSymbols().contains(fileName.getName())) {
                logInfo("   imported " + fileName);
                ++imported;
            } else {
                export.getSymbols().add(fileName.getName());
                MessageDigest algo = MessageDigest.getInstance("MD5");
                algo.update(fileContent.getBytes());
                String md5 = bytesToHexString(algo.digest());
                newHashes.put(fileName.getName(), md5);

                if (!context.getSettings().isUseHash() || !oldFiles.contains(fileName) || !md5.equals(oldHashes.getProperty(fileName.getName()))) {
                    fileName.setWritable(true);
                    BufferedOutputStream writer = new BufferedOutputStream(new FileOutputStream(fileName));
                    writer.write(fileContent.getBytes());
                    fileName.setWritable(false);
                    writer.close();
                    ++generated;
                    logInfo("   generated " + fileName);
                } else {
                    ++skipped;
                    logInfo("   skipped " + fileName);
                }
                oldFiles.remove(fileName);
            }
        } catch (Exception e) {
            throw new RuntimeException("Failed to save file " + e.getMessage());
        }
    }
260717
public static void saveBmp(Bitmap src, String fileName) throws ImageSaveException {
        try {
            BitmapUtil.save(src, fileName);
        } catch (IOException e) {
            throw new ImageSaveException(e);
        }
    }
513847
public final static void writeByteArray(final byte[] a, final ObjectOutputStream s) throws IOException {
		writeVByte(a.length, s);
		s.write(a);
	}
1149948
@Override
	public void writeFile(List lblSeqs, String filename) {
		String ret = writeString(lblSeqs);
		try{
			BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
					new FileOutputStream(filename), "UTF-8"));
			out.write(ret);
			out.close();
		}
		catch (Exception e){
			
		}
	}
1273337
@GwtIncompatible("com.google.io.Files")
  public void save(String filename) throws IOException {
    Files.write(toBytes(), new File(filename));
  }
1342089
public void saveWaveAsFile(String filename) {

        WaveHeader waveHeader = wave.getWaveHeader();

        int byteRate = waveHeader.getByteRate();
        int audioFormat = waveHeader.getAudioFormat();
        int sampleRate = waveHeader.getSampleRate();
        int bitsPerSample = waveHeader.getBitsPerSample();
        int channels = waveHeader.getChannels();
        long chunkSize = waveHeader.getChunkSize();
        long subChunk1Size = waveHeader.getSubChunk1Size();
        long subChunk2Size = waveHeader.getSubChunk2Size();
        int blockAlign = waveHeader.getBlockAlign();

        try {
            FileOutputStream fos = new FileOutputStream(filename);
            fos.write(WaveHeader.RIFF_HEADER.getBytes());
            // little endian
            fos.write(new byte[] {(byte) (chunkSize), (byte) (chunkSize >> 8), (byte) (chunkSize >> 16),
                            (byte) (chunkSize >> 24)});
            fos.write(WaveHeader.WAVE_HEADER.getBytes());
            fos.write(WaveHeader.FMT_HEADER.getBytes());
            fos.write(new byte[] {(byte) (subChunk1Size), (byte) (subChunk1Size >> 8), (byte) (subChunk1Size >> 16),
                            (byte) (subChunk1Size >> 24)});
            fos.write(new byte[] {(byte) (audioFormat), (byte) (audioFormat >> 8)});
            fos.write(new byte[] {(byte) (channels), (byte) (channels >> 8)});
            fos.write(new byte[] {(byte) (sampleRate), (byte) (sampleRate >> 8), (byte) (sampleRate >> 16),
                            (byte) (sampleRate >> 24)});
            fos.write(new byte[] {(byte) (byteRate), (byte) (byteRate >> 8), (byte) (byteRate >> 16),
                            (byte) (byteRate >> 24)});
            fos.write(new byte[] {(byte) (blockAlign), (byte) (blockAlign >> 8)});
            fos.write(new byte[] {(byte) (bitsPerSample), (byte) (bitsPerSample >> 8)});
            fos.write(WaveHeader.DATA_HEADER.getBytes());
            fos.write(new byte[] {(byte) (subChunk2Size), (byte) (subChunk2Size >> 8), (byte) (subChunk2Size >> 16),
                            (byte) (subChunk2Size >> 24)});
            fos.write(wave.getBytes());
            fos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
1170380
public T loadCSV( String fileName )
            throws IOException {
        DMatrix mat = MatrixIO.loadCSV(fileName,true);

        T ret = createMatrix(1,1, mat.getType());

        ret.setMatrix(mat);

        return ret;
    }