Help coderanch get a
new server
by contributing to the fundraiser

yacoob ali

Greenhorn
+ Follow
since Aug 20, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by yacoob ali

Hi,

I have a folder c:\test\data which is configured in classpath through admin console of WSAD. When i try to access some files in this folder i use getClass.getResource(\data\test.txt) which works if i run on websphere server. My problem is i want to write a junit test case for this method. the junit test case is stand alone and doesn't have this on the classpath

can anyone help on this.
19 years ago
Hi,

Iam posting the code that you require hope it helps you


19 years ago
Hi Tony,

You can try this


In the above code you can see after the parsing it gives with the time then you can format the date to whatever format you want.

You can also have a look at these links

http://java.sun.com/developer/JDCTechTips/2003/tt0624.html#2
http://java.sun.com/docs/books/tutorial/i18n/format/dateFormat.html

Hope this helps



20 years ago
Hi,

I don't think you can add multiple values for a single key in a TreeMap. But i think you can add the values in LinkedList or a Vector and then you can map it with the key in a TreeMap.

Hope it helps you

20 years ago
Hi guys,

Really got interested in the discussion and tried your code but unfortunately it works when i run through intel Idea.
Iam getting different results when i run through idea and through command prompt infact iam using the same class file. Here is the code that i tried

FileInputStream is = new FileInputStream("D:\\test\\test.txt");
StringBuffer sb = new StringBuffer();
while ((ch = is.read()) != -1)
{
sb.append((char) ch);
}
int i = 0;
while (sb.length() > i)
{
System.out.print("["+ ((int)sb.charAt(i)) +"-'"+sb.charAt(i)+"']");
i++ ;
}

The result i got through Idea:
[104-'h'][13-'
'][10-'
'][112-'p'][13-'
'][10-'
'][100-'d'][13-'
'][10-'
'][13-'
'][10-'
'][104-'h']

and through command prompt:
'][10-''][13-'
'][10-''p'][13-'
'][10-''d'][13-'
'][10-'
'][104-'h']

I really don't understand what makes the difference

NOTE:Iam using the same class file

Hope it adds much confusion

regards
Yacoob
20 years ago