This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes errors in  compression & release Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "errors in  compression & release" Watch "errors in  compression & release" New topic

errors in compression & release

Indira Sruga

Joined: Apr 02, 2005
Posts: 1
This is the program for compression & uncompression using GZIP....

public class Gzippin {

public static void main(String[] args) {
// TODO code application logic here
String inStr = "Department of Information and Communication Technology";

ByteArrayOutputStream baos = new ByteArrayInputStream();
GZIPOutputStream gos = new GZIPInputStream(baos);

PrintWriter pw=new PrintWriter(gos);

byte [] bar = baos.toByteArray();
System.out.println (new String(bar));

ByteArrayInputStream bais= new ByteArrayInputStream(bar);
GZIPInputStream gis= new GZIPInputStream(bais);
byte [] buffer= new byte[1024];
if (gis.available() > 0),0,1024);
System.out.println(new String(buffer));

if (buffer.equals(inStr))
System.out.println("Compressed and Uncompressed strings are EQUAL");


This gives me two errors when I exected in Net beans IDE...

C:\Documents and Settings\Administrator\JavaApplication2\src\javaapplication2\ cannot find symbol
symbol : constructor ByteArrayInputStream()
location: class
ByteArrayOutputStream baos = new ByteArrayInputStream();

C:\Documents and Settings\Administrator\JavaApplication2\src\javaapplication2\ cannot find symbol
symbol : constructor GZIPInputStream(
location: class
GZIPOutputStream gos = new GZIPInputStream(baos);

Thanks in advance for ur answers....

- I S
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

Yout got what look like some bad cut-and-paste errors here. You're creating new XXXInputStreams, and assigning them to variables of type XXXOutputStream; in the process, you're using constructors that the InputStream classes don't have. Just look at the error messages carefully, and you'll see the problem.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: errors in compression & release
Similar Threads
Serialization Problem
Compressing and Decompressing strings in Java
In how many ways we can create an object? could you Explain with example if possible.
Inheritance and Serialization
Getting oversubscribed dynamic bit lengths tre