MCPcopy Create free account
hub / github.com/devilsen/CZXing / writeToFile

Method writeToFile

sample/src/main/java/me/sam/czxing/util/Utils.java:169–185  ·  view source on GitHub ↗
(String data, Context context)

Source from the content-addressed store, hash-verified

167 }
168
169 public static void writeToFile(String data, Context context) {
170 try {
171 String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
172 String fileName = "myFile.txt";
173
174 File file = new File(baseDir + File.separator + fileName);
175
176 FileOutputStream stream = new FileOutputStream(file);
177 try {
178 stream.write(data.getBytes());
179 } finally {
180 stream.close();
181 }
182 } catch (IOException e) {
183 Log.e("Exception", "File write failed: " + e.toString());
184 }
185 }
186}

Callers

nothing calls this directly

Calls 5

getAbsolutePathMethod · 0.80
closeMethod · 0.80
eMethod · 0.80
writeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected