MCPcopy Create free account
hub / github.com/adjust/android_sdk / writeObject

Method writeObject

Adjust/sdk-core/src/main/java/com/adjust/sdk/Util.java:251–280  ·  view source on GitHub ↗
(T object, Context context, String filename, String objectName)

Source from the content-addressed store, hash-verified

249 }
250
251 public static <T> void writeObject(T object, Context context, String filename, String objectName) {
252 Closeable closable = null;
253 try {
254 FileOutputStream outputStream = context.openFileOutput(filename, Context.MODE_PRIVATE);
255 closable = outputStream;
256
257 BufferedOutputStream bufferedStream = new BufferedOutputStream(outputStream);
258 closable = bufferedStream;
259
260 ObjectOutputStream objectStream = new ObjectOutputStream(bufferedStream);
261 closable = objectStream;
262
263 try {
264 objectStream.writeObject(object);
265
266 getLogger().debug("Wrote %s: %s", objectName, object);
267 } catch (NotSerializableException e) {
268 getLogger().error("Failed to serialize %s", objectName);
269 }
270 } catch (Exception e) {
271 getLogger().error("Failed to open %s for writing (%s)", objectName, e);
272 }
273 try {
274 if (closable != null) {
275 closable.close();
276 }
277 } catch (Exception e) {
278 getLogger().error("Failed to close %s file for writing (%s)", objectName, e);
279 }
280 }
281
282 public static boolean checkPermission(Context context, String permission) {
283 try {

Callers 8

writePackageQueueIMethod · 0.95
writeActivityStateIMethod · 0.95
writeAttributionIMethod · 0.95
writeEventMetadataIMethod · 0.95
serializeMethod · 0.45
serializeMethod · 0.45

Calls 3

getLoggerMethod · 0.95
debugMethod · 0.65
errorMethod · 0.65

Tested by 2

serializeMethod · 0.36
serializeMethod · 0.36