shirish katti

Ranch Hand
+ Follow
since Nov 09, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shirish katti

Hi Rob,

I have even tried it with flushing the file...

As per my knowledge flushing doesn't guarantees that the content is written to the physical disk...

I made this code time efficient, but the problem of output file of 0kb still remains the same..

10 years ago
Hi Rob,

Thanks for your prompt reply...

Thanks for make it time efficient...

Lines 114 and 130 cause your loop to break off immediately. You're join method looks for files without the ".sp" extension. If you use line 111 instead of line 112 the program actually runs.



sorry for this actually i had used line 111 itself...

Even joining is working but the thing is the joined file shows as 0kb and when i use win zip to open it.. It opens and works fine only until i keep the source file i mean the original file in the same location if i delete the source file then it doesn't work properly..

In short it gets redirected to the source file.. Any idea..
10 years ago
Hi all,

I am developing an application into which i need to split a huge zip file into 4 to 5 parts and then rejoin it...

I have tried this with the code i have attached...

The splitting part works perfectly.. Even the re joining part works but the rejoined file is of 0kb with no content into it...

Any of you free then please execute this code snippet and let me know if you have any solution...

Thanks in Advance..
10 years ago

Shirish, that will only work when the file is always located in the same folder. You can't assume that the application has been started in its root folder, or the folder where the JAR file is located. Resources are always relative to a class or the entire class path, so those seem more appropriate.



Hi Rob,

Yes if the location of file changes, then we do have properties file were we can change the path of the file to be read..

If you do have any proper solution than this then please share it..
10 years ago
I prefer head first java , from where i really got a catch of generics..
Using java it is very easy..

You can get the path of a file as below

File f=new File("fileName");
system.out.println(f.getAbsolutePath());
10 years ago
Hi chandana Try out with this..


import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class FilePath {
public static void main(String[] args) {
try{
FileInputStream fs=new FileInputStream("Path to your Xsl file");
DataInputStream in=new DataInputStream(fs);
BufferedReader br=new BufferedReader(new InputStreamReader(in));
String strLine;
while((strLine=br.readLine())!=null){
System.out.println(strLine);
}
in.close();
}catch(Exception e){
System.out.println("Error:"+e.getMessage());
}
}
}

I am sure it will work as it worked for me.. Enjoyyyyyyyy..........
10 years ago
Paul----Ehm...they can - I'm currently doing this! FlexBuilder is just an eclipse plugin. If you already have an eclipse install for your Java development, just add the FlexBuidler plugin to that and you can swap between perspectives to develop Java and ActionScript/MXML.

Is it ? If so then thats great i will try to plug in flexBuilder into eclipse.. Anyways thanks..
10 years ago
Hi david, yes you are right that java is rigid language with impoverished model.. But it would have been great for java developers if java and GUI both could be developed in FlexBuilder.. Anyways its not a big deal..
10 years ago
I even tried a lot with ZipInputStream and was totaly lost..
10 years ago
Hi Bob, I am trying with the same code you posted to unzip a file.. But its not working its throwing an exception as too many entries in zip file can you please help me..
10 years ago
Hi guys here is the code with which i am trying to unzip a zipped file (Not to be done manually )

package com.unix;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class Unzip {

/** Unzipp a Zip */
public Unzip(){}

public static void main(String args[]) throws IOException {

String inDirectory="C:\\searchResult";
String outDirectory="images/";

String[] filenames;
//String[] files=null;

File file = new File(inDirectory);
filenames =file.list();

System.out.println("FileName:"+filenames);

for(int i=0; i< filenames.length; i++) { //Don't forget this!!
File fs= new File(file.getName() + File.separator + filenames[i]);
System.out.println("File Name: " + fs);
System.out.println("Get Zip File: " + filenames[i]);

------------------------------------------------------------------------ZipFile f=new ZipFile(inDirectory+"\\"+ filenames[i]);
showing exception on the above line as too many entries


System.out.println("Got ZipFile:"+f);
//fs.delete();
Enumeration entries= f.entries();
System.out.println("Decompressing Data");

while(entries.hasMoreElements()){

ZipEntry entry=(ZipEntry) entries.nextElement();

InputStream in = f.getInputStream(entry);
FileOutputStream out = new FileOutputStream(outDirectory +
"" + entry.getName());

for(int ch=in.read();ch!=-1;ch=in.read()) out.write(ch);
out.close();
in.close();
} //end while
f.close();
} // end for
try {
} catch(Exception e) {
e.printStackTrace();
}
System.out.println("Unzipping Completed Successfully.");
} //end main
} //end class

After running this code i am getting:

FileName:[Ljava.lang.String;@45a877
File Name: searchResult\search_result.zip
Get Zip File: search_result.zip
Exception in thread "main" java.util.zip.ZipException: too many entries in ZIP file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:203)
at java.util.zip.ZipFile.<init>(ZipFile.java:84)
at com.unix.Unzip.main(Unzip.java:35)


Can any one help me ???
10 years ago
Surely, there will be no more duplications..
10 years ago