This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes sequence input stream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "sequence input stream" Watch "sequence input stream" New topic
Author

sequence input stream

smriti singla
Greenhorn

Joined: Nov 14, 2000
Posts: 18
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).]
Sridevi Shrikanth
Ranch Hand

Joined: Jan 11, 2001
Posts: 31
This might be because SequenceInputStream takes
Enumeration and Not Iterator as an constructor argument.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sequence input stream
 
Similar Threads
Reader question: Tiger's for loop
[Resolved]java.util.NoSuchElementException problem after displaying the information from text file
help on file dialog class
help on Sequence Input Stream
problem with string array