use of javax.microedition.io.HttpConnection in project CodenameOne by codenameone.
the class BlackBerryOS5Implementation method openOutputStream.
/**
* (non-Javadoc)
*
* @see
* com.codename1.impl.blackberry.BlackBerryImplementation#openOutputStream(java.lang.Object)
*/
public OutputStream openOutputStream(Object connection) throws IOException {
if (connection instanceof String) {
return super.openOutputStream(connection);
}
OutputStream os = ((HttpConnection) connection).openOutputStream();
// getSoftwareVersion() not available in legacy port,introduced at API 4.3.0
int majorVersion = DeviceInfo.getSoftwareVersion().charAt(0) - '0';
// in version 7, BBOS started supporting HTTP 1.1, so facade not required.
if (majorVersion < 7) {
os = new BlackBerryOutputStream(os);
}
return new BufferedOutputStream(os, ((HttpConnection) connection).getURL());
}
use of javax.microedition.io.HttpConnection in project CodenameOne by codenameone.
the class GameCanvasImplementation method getHeaderFieldNames.
/**
* @inheritDoc
*/
public String[] getHeaderFieldNames(Object connection) throws IOException {
HttpConnection c = (HttpConnection) connection;
Vector r = new Vector();
int i = 0;
String key = c.getHeaderFieldKey(i);
while (key != null) {
if (r.indexOf(key) < 0) {
r.addElement(key);
}
i++;
key = c.getHeaderFieldKey(i);
}
if (r.size() == 0) {
return null;
}
String[] response = new String[r.size()];
for (int iter = 0; iter < response.length; iter++) {
response[iter] = (String) r.elementAt(iter);
}
return response;
}
Aggregations