MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / createWriter

Method createWriter

CodenameOne/src/com/codename1/io/Log.java:492–508  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

490 ///
491 /// - `IOException`: when thrown by the connector
492 protected Writer createWriter() throws IOException {
493 try {
494 if (getFileURL() == null) {
495 return Util.getWriter(Storage.getInstance().createOutputStream("CN1Log__$"));
496 }
497 if (FileSystemStorage.getInstance().exists(getFileURL())) {
498 return Util.getWriter(FileSystemStorage.getInstance().openOutputStream(getFileURL(),
499 (int) FileSystemStorage.getInstance().getLength(getFileURL())));
500 } else {
501 return Util.getWriter(FileSystemStorage.getInstance().openOutputStream(getFileURL()));
502 }
503 } catch (IOException err) {
504 return fallbackWriterAfterError();
505 } catch (RuntimeException err) {
506 return fallbackWriterAfterError();
507 }
508 }
509
510 private Writer fallbackWriterAfterError() {
511 setFileWriteEnabled(false);

Callers 2

getWriterMethod · 0.95
setFileURLMethod · 0.95

Calls 9

getFileURLMethod · 0.95
getWriterMethod · 0.95
getInstanceMethod · 0.95
getInstanceMethod · 0.95
createOutputStreamMethod · 0.80
existsMethod · 0.65
openOutputStreamMethod · 0.65
getLengthMethod · 0.65

Tested by

no test coverage detected