2 Replies Latest reply on Nov 28, 2017 9:44 AM by Steven Hawkins

    java.lang.ClassCastException: org.teiid.common.buffer.FileStore$1 cannot be cast to java.io.SequenceInputStream

    Ali Imtiaz Newbie

      Hi I am working on streaming multiple files from source to target in call backs and due to some limitations of custom inputStream factory architecture (can only return inputStream object) I have to write all multiple files into single input Stream. So for that I am using SequenceInputStream which combines the multiple file inputStream into one single in a sequence. Now the problem is when i return SequenceInputStream object from source and receive at target its converted into org.teiid.common.buffer.FileStore$1 so i try to cast it into SequenceInputStream but its giving me exception.

      Please help me get this SequenceInputStream object again at target end





      //OWTStreamFactory  extends InputStreamFactory


      public class ExternalFileHandler implements OWTStreamCallback {
          public InputStream readStreamingData(Connection connection) throws IOException {
              try {
                  List < PipedInputStream > pipinList = new ArrayList < PipedInputStream > ();
                  for (String fileSingle: fileNames) {
                      PipedInputStream pipedInputStream = new PipedInputStream(PIPE_SIZE);
                      PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
                      Thread t1 = new FileDataReader(pipedOutputStream, fileSingle);
                  SequenceInputStream bin = new SequenceInputStream(Collections.enumeration(pipinList));
                  return bin;
              } catch (Exception e) {
                  throw new IOException("File to read external file. Error " + e.getMessage(), e);


      Write CODE


      public void writeStreamingData(OWTConnection connection, Object data) throws IOException {
          try {
              BlobType blobimp = (BlobType) data;
              SequenceInputStream bin = (SequenceInputStream) blobimp.getBinaryStream();
          } catch (Exception ex) {
              throw ex;