Add storeJson
This commit is contained in:
		
							parent
							
								
									41455472c7
								
							
						
					
					
						commit
						7007787848
					
				
							
								
								
									
										22
									
								
								src/main/java/sh/adb/sensorCommunityAPI/dataStore.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/main/java/sh/adb/sensorCommunityAPI/dataStore.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | |||||||
|  | package sh.adb.sensorCommunityAPI; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import org.json.simple.JSONObject; | ||||||
|  | 
 | ||||||
|  | import java.io.FileWriter; | ||||||
|  | import java.io.IOException; | ||||||
|  | 
 | ||||||
|  | public class dataStore { | ||||||
|  |     public boolean storeJson(String path, JSONObject json) throws IOException { | ||||||
|  |         boolean check = false; | ||||||
|  | 
 | ||||||
|  |         FileWriter file = new FileWriter(path); | ||||||
|  |         try { | ||||||
|  |             file.write(json.toJSONString()); | ||||||
|  |             check = true; | ||||||
|  |         }catch (IOException e){ | ||||||
|  |             System.out.println("Sorry cant write in file" + path); | ||||||
|  |         } | ||||||
|  |         return check; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										0
									
								
								src/main/java/sh/adb/sensorCommunityAPI/get.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/main/java/sh/adb/sensorCommunityAPI/get.json
									
									
									
									
									
										Normal file
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user