I had a problem similar to this when I was doing a .xls output. The problem might be memory exception with the file size you are working with. try shrinking the amount you are trying to read to a specific amount of records at a time. I believe that should help you.
Man u made a silly mistake in ur code Your class name is getTar and you have a method named public void getTar() Note that the method name and the class name are same.Java is treatng your method getTar as constuctor. You should not have return type for a constructor.This is the reason behind the problem. I think u got it Always keep java naming conventions in mind. Your class name should be GetTar and not getTar
Having a class named "getJar" with a method named "getJar" is a poor design, but shouldn't cause the problem "z meng" is experiencing. Java is smart enough to realize that the "getJar()" method is NOT a constructor, and will work despite the poor choice of naming. A more likely culprit is with the FTP protocol itself. FTP works in two modes: "bin" (binary) and "asc" (ascii). If you use bin, it will bring the file across "as is", byte-by-byte. If you use asc, it will try and translate end-of-line characters appropriately for the machines it is transferring to. Transferring files between different OS-es (such as UNIX and Windows) will usually change the file size since the end-of-line character(s) are different. You should use the "asc" mode only for ascii (text) files. Since you are trying to transfer a binary file, you need to make sure you are doing a binary transfer. Some FTP servers default to "bin" mode, other default to "asc" mode. To force a binary transfer, you need to issue the "bin" (or "binary") command before doing the "get". This should solve your problem. Good luck! [ September 08, 2003: Message edited by: Wayne L Johnson ]
I don't think z meng is using FTP from his socket declaration echoSocket = new Socket("192.168.0.111", 2001) But point raised by Wayne L Johnson is a valid point. In case of FTP if request is valid and after issuing pasv command, the server will send data port(which is not its default data port) and to waits for a connection and sends a response .The response includes the host and port address this server is listening on.
I don't think z meng is using FTP from his socket declaration echoSocket = new Socket("192.168.0.111", 2001)
Murthy is correct since the default port for FTP is 21; I should have been included that assumption in my initial reply. The reason I focused on "FTP" is because after making a socket connection, the code issues a "get ...", which is an FTP command, and because the problem described could be explained by the bin/ascii modes in FTP. If "FTP" is being used, then issuing a "bin" command prior to the "get" should solve it. If some other protocol is being used, we need to know what it is. It may still boil down to the server doing an end-of-line character conversion which is changing the file size.