use of javax.microedition.io.file.FileConnection in project CodenameOne by codenameone.
the class BlackBerryImplementation method openInputStream.
/**
* @inheritDoc
*/
public InputStream openInputStream(Object connection) throws IOException {
if (connection instanceof String) {
FileConnection fc = (FileConnection) Connector.open((String) connection, Connector.READ);
BufferedInputStream o = new BufferedInputStream(fc.openInputStream(), (String) connection);
o.setConnection(fc);
return o;
}
return new BufferedInputStream(((HttpConnection) connection).openInputStream(), ((HttpConnection) connection).getURL());
}
use of javax.microedition.io.file.FileConnection in project CodenameOne by codenameone.
the class BlackBerryImplementation method deleteFile.
/**
* @inheritDoc
*/
public void deleteFile(String file) {
FileConnection fc = null;
try {
fc = (FileConnection) Connector.open(file, Connector.WRITE);
fc.delete();
} catch (IOException err) {
err.printStackTrace();
} finally {
cleanup(fc);
}
}
use of javax.microedition.io.file.FileConnection in project CodenameOne by codenameone.
the class GameCanvasImplementation method deleteFile.
/**
* @inheritDoc
*/
public void deleteFile(String file) {
FileConnection fc = null;
try {
fc = (FileConnection) Connector.open(file, Connector.WRITE);
fc.delete();
} catch (IOException err) {
err.printStackTrace();
} finally {
cleanup(fc);
}
}
use of javax.microedition.io.file.FileConnection in project CodenameOne by codenameone.
the class GameCanvasImplementation method openOutputStream.
/**
* @inheritDoc
*/
public OutputStream openOutputStream(Object connection, int offset) throws IOException {
FileConnection fc = (FileConnection) Connector.open((String) connection, Connector.READ_WRITE);
if (!fc.exists()) {
fc.create();
}
BufferedOutputStream o = new BufferedOutputStream(fc.openOutputStream(offset), (String) connection);
o.setConnection(fc);
return o;
}
use of javax.microedition.io.file.FileConnection in project CodenameOne by codenameone.
the class GameCanvasImplementation method setHidden.
/**
* @inheritDoc
*/
public void setHidden(String file, boolean h) {
FileConnection fc = null;
try {
fc = (FileConnection) Connector.open(file, Connector.READ_WRITE);
fc.setHidden(h);
} catch (IOException err) {
err.printStackTrace();
} finally {
cleanup(fc);
}
}
Aggregations