• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

wav file serialization?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
should i serialize a wav file before using it reading it. if so how do i do that.
i have a file in the directory that is in wav format and i want to read it into my program. what file stream do i use?
i have tried this code so far : 2 classes.
import java.io.*;
import java.util.*;

class Tester implements Serializable{
Object myFile;
public Tester getTest()
{
return (Tester)myFile;
}
public void setTest(Object myFile)
{
this.myFile = myFile;
}

}
and the one that reads the object

import java.io.*;
import java.util.*;

public class ObjectFromDisk{
public static void main(String []arg)
{
try{
FileInputStream fi = new FileInputStream("connect.wav");
ObjectInputStream oi = new ObjectInputStream(fi);
Tester tes = (Tester) oi.readObject();
System.out.println("I hope this works");
oi.close();
}catch(Exception e){System.out.println("Error -- " + e.toString());
}
}
}

i keep getting this error however :
java.io.StreamCorruptedException : invalid stream header.
 
reply
    Bookmark Topic Watch Topic
  • New Topic