File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes wav file serialization? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "wav file serialization?" Watch "wav file serialization?" New topic

wav file serialization?

Trelan Hylton

Joined: Apr 15, 2003
Posts: 27
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.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.util.*;

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

i keep getting this error however : : invalid stream header.

I agree. Here's the link:
subject: wav file serialization?
jQuery in Action, 3rd edition