MCPcopy Create free account
hub / github.com/Singular/Singular / save

Method save

Singular/LIB/surfex/Project.java:839–905  ·  view source on GitHub ↗
(String filelocation)

Source from the content-addressed store, hash-verified

837 }
838
839 public void save(String filelocation) {
840 if (surfex_.inAnApplet) {
841 try {
842 // ??? this should be done for all open projects!!!
843 URL url = new URL(surfex_.webPrgs.surfPath.getText()
844 + "surfex_comp.php");
845 URLConnection connection = url.openConnection();
846 connection.setUseCaches(false);
847 connection.setDoOutput(true);
848
849 PrintWriter out = new PrintWriter(connection.getOutputStream());
850 //System.out.println("save
851 // tmpdir:"+surfex_.getCurrentProject().old_tmpsubdir);
852 out
853 .print("tmpsubdir="
854 + URLEncoder
855 .encode(this.old_tmpsubdir)
856 + "&prg=save" + "&filelocation="
857 + URLEncoder.encode(filelocation)
858 + "&prg_code_part1="
859 + URLEncoder.encode(getSuxFile()));
860 out.close();
861
862 BufferedReader in = new BufferedReader(new InputStreamReader(
863 connection.getInputStream()));
864 String inputLine = in.readLine();
865 if (inputLine.equals("okay")) {
866 // it worked
867 inputLine = in.readLine();
868 this.old_tmpsubdir = in.readLine();
869 }
870 } catch (Exception e) {
871 System.out.println("closeSurfex:" + e.toString());
872 }
873
874 return;
875 }
876
877 // Project speichern
878 // lege datei an oder ueberschreibe
879 if (filename == null) {
880 System.out.println("null file");
881 } else {
882 try {
883 String proName = ((new File(filelocation)).getCanonicalPath()).substring
884 (((new File(filelocation)).getCanonicalPath()).lastIndexOf(File.separator)+1);
885 projectName = proName;
886 surfex_.pane.setTitleAt(surfex_.pane.getSelectedIndex(), projectName);
887 } catch(Exception ex) {
888 System.out.println("Exception in loadProject:"+ex.toString());
889 }
890 //System.out.println("filenem");
891 }
892 try {
893 FileOutputStream fo = new FileOutputStream(filename);
894 /*
895 * JDK-1.0-Version:
896 *

Callers 4

actionPerformedMethod · 0.95
actionCommandMethod · 0.95
create_tableFunction · 0.45
getSuxFileMethod · 0.45

Calls 5

getSuxFileMethod · 0.95
encodeMethod · 0.80
closeMethod · 0.80
printMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected