August 07, 2014

How to read text from file in iOS ?

Utility.h ============================ +(NSString*) readContentFromFile:(NSString *)fileNameString; Utility.m ============================ +(NSString*) readContentFromFile : (NSString *)fileNameString { //get the documents directory: NSArray *path = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [path objectAtIndex:0]; //make a file name to w ...

Read more
August 06, 2014

How to write text into a file in iOS?

//How to use this method. [Utility writeToTextFile:@"content of file " fileName:@"/Terms"]; // It is class method for Utility class. +(void) writeToTextIntoFile:(NSString *)contentOfFile fileName:(NSString *) fileNameString { //get the documents directory: NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0] ...

Read more
July 31, 2014

Difference between hashtable and hashmap ?

1.Hashtable is synchronized which means Hashtable is thread-safe and can be shared between multiple threads while Hashmap is not synchronized. 2.HashMap allows null values as key and value whereas Hashtable does not allow. but only one NULL value is allowed a key. it can have multiple NULL values. 3. Hashtable does execution slow then Hashmap. due synchronization. ...

Read more
July 31, 2014

How to use Hashmap in Java ?

import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; public class Hashmapdemo { public static void main(String args[]) { // Create a hash map Hashtable hashTable = new Hashtable(); Enumeration names; String str; hashTable.put("k1","v1"); hashTable.put("k2","v2"); hashTable.put("k3","v1"); hashTable.put("k4","v1"); hashTable.put("k5","v2"); hashTable.put("k6","v1"); hashTable.pu ...

Read more
July 31, 2014

synchronization in Java

Synchronization in Java use to lock over a resource when two thread is trying to use same resource. Synchronization guarantees that multiple thread cannot allow to share the same resource at a time. ...

Read more
Scroll to top