• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

help on Sequence Input Stream

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i am facing a problem in the following program based on SequenceInputStream class.i am getting a compile time error as following
Sequence.java:63:cannot resolve symbol
symbol : constructor SequenceInputStream(S)
location: class java.io.SequenceInputStream
InputStream d=new SequenceInputStream(s);
^
The program is as follows:
import java.io.*;
import java.util.*;
class Seq implements Iterator
{
private String[] g;
private int f=0;

public Seq(String[] g)
{
this.g=g;
}
//----------------------------------------------------------
public boolean hasNext()
{
if(f<g.length)>
{
return true;
}
else
{
return false;
}
}
//-------------------------------------------------------
public Object next()
{
InputStream i=null;
if(!hasNext())
{
throw new NoSuchElementException("no more files");
}
else
{
String next=g[f];
f++;
try{i=new FileInputStream(next);}
catch(FileNotFoundException e){
System.err.println("ListOfFiles: Can't open " + next);}
}
return i;
}
//----------------------------------------------------
public void remove()
{}
}
//---------------------------------------------------
public class Sequence
{
public static void main(String[] args) throws IOException
{
S s=new S(args);
InputStream d = new SequenceInputStream(s);
int j;
while ((j = d.read()) != -1)
System.out.write(j);
d.close();
}
}
Any help will be highly appreciated.
Thanks
Smriti Singla
[This message has been edited by smriti singla (edited January 21, 2001).]
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Smriti.
You'r code looks a bit strange...for instance, this part cannot be right:
<PRE>
public boolean hasNext()
{
if(f {
return true;
}
else
{
return false;
}
}
</PRE>
The IF clause does not have a closing parenthesis...your code may have become corrupted when you posted it, if so, you should edit it and check the box under the message textarea, Disable smilies, and perhaps also turn off UBB/HTML.
Anyway, your code makes an invokation of an object from a class named 'S'. What is the class 'S'? Is it a valid argument for the SequenceInputStream constructor?
Regards,
Marius
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic