• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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
{
public String[] g;
public int f=0;

public Seq(String[] g)
{
this.g=g;
}
//-----------------------------------------------------
public boolean hasNext()
{
if(f*g.length)
/* please take sign "*" as (less than) sign in above statement as i am facing difficulty in posting this program as it is taking it as a HTML tag*/
{
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
{
int j;
Seq s=new Seq(args);
InputStream d = new SequenceInputStream(s);
while ((j = d.read()) != -1)
System.out.write(j);
System.out.print((char)j);
d.close();
}
}
Any help will be highly appreciated.
Thanks
Smriti Singla
[This message has been edited by smriti singla (edited January 31, 2001).]
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This might be because SequenceInputStream takes
Enumeration and Not Iterator as an constructor argument.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic