visit following link then you can find out more
http://developer.android.com/sdk/1.5_r3/installing.html
I hope to share my knowledge with the others in software and networking industry
Get requested page from Http Connection java blackberry development
public static String getPage(String url)
{
String response = "";
try {
HttpConnection conn = (HttpConnection)Connector.open(url, Connector.READ_WRITE);
InputStream input =conn.openInputStream();
byte[] data = new byte[256];
int len = 0;
StringBuffer raw = new StringBuffer();
while( -1 != (len = input.read(data)))
{
raw.append(new String(data, 0, len));
}
response = raw.toString();
input.close();
} catch(Exception e)
{
Dialog.alert("Error");
}
return response;
}
{
String response = "";
try {
HttpConnection conn = (HttpConnection)Connector.open(url, Connector.READ_WRITE);
InputStream input =conn.openInputStream();
byte[] data = new byte[256];
int len = 0;
StringBuffer raw = new StringBuffer();
while( -1 != (len = input.read(data)))
{
raw.append(new String(data, 0, len));
}
response = raw.toString();
input.close();
} catch(Exception e)
{
Dialog.alert("Error");
}
return response;
}
Read file to base 64 String in java blackberry device
public String readFileToBase64(String path)
{
String str = null;
try
{
FileConnection fc = (FileConnection)Connector.open(path, Connector.READ);
if(!fc.exists())
{
System.out.println("File doesn't exist!");
}
else
{
int size = (int)fc.fileSize();
InputStream is = fc.openInputStream();
byte bytes[] = new byte[size];
is.read(bytes, 0, size);
Base64 bb=new Base64();
byte bytes1[]=Base64.encodeBase64(bytes);
str=new String(bytes1);
Dialog.alert(" Length of String="+str.length());
}
}
catch (IOException ioe)
{
System.out.println("IOException: "+ioe.getMessage());
}
return str;
}
You have to import
org.apache.commons.codec.binary.Base64
find this and save in your project area
{
String str = null;
try
{
FileConnection fc = (FileConnection)Connector.open(path, Connector.READ);
if(!fc.exists())
{
System.out.println("File doesn't exist!");
}
else
{
int size = (int)fc.fileSize();
InputStream is = fc.openInputStream();
byte bytes[] = new byte[size];
is.read(bytes, 0, size);
Base64 bb=new Base64();
byte bytes1[]=Base64.encodeBase64(bytes);
str=new String(bytes1);
Dialog.alert(" Length of String="+str.length());
}
}
catch (IOException ioe)
{
System.out.println("IOException: "+ioe.getMessage());
}
return str;
}
You have to import
org.apache.commons.codec.binary.Base64
find this and save in your project area
Subscribe to:
Posts (Atom)
Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release
Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...
-
When we increase timeout value in API Manager we have to set 3 properties. 1) Global timeout defined in synapse.properties (\repository\...
-
No matching resource found error or authentication failure can happen due to few reasons. Here we will discuss about errors can happen d...
-
Address and WSDL endpoints can be suspended if they are detected as failed endpoints. When an endpoint is in in suspended state for a speci...