views:

144

answers:

1

I am very new to Java programming so please bare with me. I am building a build process for our web development team. All it needs to do is read a global.css file, find all the stylesheets that are used for the project, concat them into one large file, then compress this file using the YUI Compressor. So far I am all the way up to the point of the compressor.

I am importing the YUI Compressor jar file. I am able to create a CssCompressor object and it works! But, the issue I am having is that the file that is outputted is being cut off. The compressor is leaving off the last 1/4 of the file. It literally cuts off in the middle of a CSS declaration.

I thought it might be the concatenation that was causing this but it is combining all the stylesheets correctly. Any help/guidance would be greatly appreciated. Also, like I said, I am very new to Java, so if you have a solution please explain it to me like I am 3 years old.

+1  A: 

Cutting off an output file sounds to me like you are not closing the stream when you are done with it (actually flushing is the necessary bit, but closing should automatically flush the stream).

Is there a close() method somewhere for you to call?

Michael Myers
That was it! Thank you for your help and thank you for helping me learn a valuable lesson in Java...close your stream!
Lark
Learned the hard way by many a programmer, including me. :)
Michael Myers