Sometimes we need to keep some files within our project and use them to keep data.
for this purpose we can use this method.Once we make cod or alx we don't have to
worry about this file or its location.specially store information like top scores in some
game,settings,security certificates we can use this
public String ReadFile()
{
//This retturns the String in FileName.txt
//File must locate in Src Folder
try {
Class classs = Class.forName("packageName.ClassName");
//Source Package neme and Class name
InputStream is = classs.getResourceAsStream("/FileName.txt");
byte[] data = new byte[is.available()];
is.read(data, 0, is.available());
String c =new String(data);
return c;
}
catch (Exception ioe)
{
Dialog.alert("Error");
return null;
}
}
I hope to share my knowledge with the others in software and networking industry
Subscribe to:
Post Comments (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...
-
Remove current installation of Nginx sudo apt-get purge nginx nginx-common nginx-full Install Nginx sudo apt-get install nginx Edit c...
-
Here i'm explaining solution for manage multiple API Manager environments and external key management server to build central API r...
-
When we increase timeout value in API Manager we have to set 3 properties. 1) Global timeout defined in synapse.properties (\repository\...
No comments:
Post a Comment