Save world to the specified file.

@param media The output media.
@throws LionEngineException If error on saving to file.
357793
public final void saveToFile(Media media)
    {
        try (FileWriting writing = new FileWriting(media))
        {
            saving(writing);
        }
        catch (final IOException exception)
        {
            throw new LionEngineException(exception, media, "Error on saving to file !");
        }
    }
824057
@Override
  public <T> void save(Object objectToSave, Class<T> entityClass) {
    save(objectToSave, Util.determineCollectionName(entityClass));
  }
1158146
public void save(String file) throws IOException,FileNotFoundException
	{
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
		oos.writeObject(blockerNames);
		oos.writeObject(datasetNames);
		oos.writeObject(learnerNames);
		oos.writeObject(expt);
		oos.close();
	}
471547
public void save(OutputStream stream) throws IOException
    {
        DataOutputStream out = null;
        try
        {
            out = new DataOutputStream(new BufferedOutputStream(
                    stream));
            for (int i = 0; i < _array.length; ++i)
            {
                out.writeInt(_array[i]);
            }
        }
        finally
        {
            if (out != null)
            {
                out.close();
            }
        }
    }
58590
public void writeToFile(String path) {
        try {
            try (OutputStream os = new FileOutputStream(path)) {
                InputStreams.transferTo(body(), os);
            }
        } catch (IOException e) {
            throw new RequestsException(e);
        } finally {
            close();
        }
    }
496358
public static void saveReport(String xml, String path) {
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream(path);
			fos.write(xml.getBytes("UTF-8"));
			fos.flush();
		} catch (Exception ex) {
			LOG.error(ex.getMessage(), ex);
			ex.printStackTrace();
		} finally {
			if (fos != null) {
				try {
					fos.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
1079681
public void addWorld(String name) {
        if (name != null && Common.getInstance().getServerCaller().worldExist(name) && !worldExist(name)) {
            worldList.add(name);
            save();
        }
    }
24724
public void saveFile(File file, String type)
   {
      if (file != null)
      {
         m_treeController.saveFile(file, type);
      }
   }
276604
public void save(DataOutputStream out) throws Exception
    {
        TextUtility.writeString(model_header, out);
        TextUtility.writeString(root, out);

        out.writeInt(use_distance ? 1 : 0);
        out.writeInt(use_valency ? 1 : 0);
        out.writeInt(use_cluster ? 1 : 0);

        W1.save(out);
        W2.save(out);
        E.save(out);
        b1.save(out);
        saved.save(out);

        forms_alphabet.save(out);
        postags_alphabet.save(out);
        deprels_alphabet.save(out);

        save_map(precomputation_id_encoder, out);

        if (use_cluster)
        {
            cluster4_types_alphabet.save(out);
            cluster6_types_alphabet.save(out);
            cluster_types_alphabet.save(out);

            save_map(form_to_cluster4, out);
            save_map(form_to_cluster6 , out);
            save_map(form_to_cluster , out);
        }
    }
835544
public void batchSave(Object... objectsToSave) {
        batchWrite(Arrays.asList(objectsToSave), Collections.emptyList(), this.config);
    }
344064
public void save() {
		int resp = saveChooser.showSaveDialog(this);
		if (resp == JFileChooser.APPROVE_OPTION) {
			File file = saveChooser.getSelectedFile();
			String type = null;
			if (file.getName().endsWith(".png")) {
				type = "PNG";
			}
			if (file.getName().endsWith(".gif")) {
				type = "GIF";
			}
			if (file.getName().endsWith(".jpg")) {
				type = "JPG";
			}
			if (type == null) {
				file = new File(file.getAbsolutePath()+".png");
				type = "PNG";
			}
			
			try {
				ImageIO.write(imagePanel.getImage(), type, file);
			} catch (Exception e) {
				e.printStackTrace();
				JOptionPane.showMessageDialog(this, "Unable to save file "+file.getName());
			}
		}
	}
854828
private void saveScreenshotTo(final File file) throws IOException {
		byte[] bytes = null;
		try {
			bytes = ((TakesScreenshot) driver)
					.getScreenshotAs(OutputType.BYTES);
		} catch (ClassCastException e) {
			WebDriver augmentedDriver = new Augmenter().augment(driver);
			bytes = ((TakesScreenshot) augmentedDriver)
					.getScreenshotAs(OutputType.BYTES);
		}

		Files.write(bytes, file);
	}
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();
        }
    }
1207592
public void save(String saveModelFile) throws IOException {
		System.out.println("save ...");
		ObjectOutputStream out = new ObjectOutputStream(
				new BufferedOutputStream(new GZIPOutputStream(
						new FileOutputStream(saveModelFile))));
		out.writeObject(new Integer(n));
		out.close();
		System.out.println("OK");
	}
995694
public void save() throws IOException {
        JFileChooser fc = FileChooser.getInstance();
        fc.setFileFilter(FileChooser.SimpleFileFilter.getWritableImageFIlter());
        fc.setAcceptAllFileFilterUsed(false);
        fc.setSelectedFiles(new File[0]);
        int returnVal = fc.showSaveDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            save(file);
        }        
    }
548099
public function saveMedia(Media $media)
    {
        if (!$media->getContent() instanceof File) {
            return;
        }

        $this->uploader->uploadMedia($media);
    }
112168
public static void write(Object value, MediaEncoder encoder, Writer out) throws IOException {
		if(encoder==null) {
			write(value, out);
		} else {
			// Otherwise, if A is null, then the result is "".
			// Write nothing
			if(value != null) {
				// Unwrap out to avoid unnecessary validation of known valid output
				while(true) {
					out = unwrap(out);
					if(out instanceof MediaValidator) {
						MediaValidator validator = (MediaValidator)out;
						if(validator.canSkipValidation(encoder.getValidMediaOutputType())) {
							// Can skip validation, write directly to the wrapped output through the encoder
							out = validator.getOut();
						} else {
							break;
						}
					} else {
						break;
					}
				}
				// Write through the given encoder
				if(value instanceof String) {
					// If A is a string, then the result is A.
					encoder.write((String)value, out);
				} else if(value instanceof Writable) {
					Writable writable = (Writable)value;
					if(writable.isFastToString()) {
						encoder.write(writable.toString(), out);
					} else {
						// Avoid intermediate String from Writable
						writable.writeTo(encoder, out);
					}
				} else if(value instanceof Node) {
					// Otherwise, if is a DOM node, serialize the output
					try {
						// Can use thread-local or pooled transformers if performance is ever an issue
						TransformerFactory transFactory = TransformerFactory.newInstance();
						Transformer transformer = transFactory.newTransformer();
						transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
						transformer.transform(
							new DOMSource((Node)value),
							new StreamResult(new MediaWriter(encoder, out))
						);
					} catch(TransformerException e) {
						throw new IOException(e);
					}
				} else {
					// Otherwise, if A.toString() throws an exception, then raise an error
					// Otherwise, the result is A.toString();
					encoder.write(value.toString(), out);
				}
			}
		}
	}