1 3 package org.faceless.pdf; 4 5 import java.util.*; 6 import java.io.*; 7 8 29 public class PDFSound extends PeeredObject 30 { 31 final org.faceless.pdf2.PDFSound sound; 32 33 Object getPeer() 34 { 35 return sound; 36 } 37 38 PDFSound(org.faceless.pdf2.PDFSound sound) 39 { 40 this.sound=sound; 41 } 42 43 49 public PDFSound(InputStream in) 50 throws IllegalArgumentException , IOException 51 { 52 sound = new org.faceless.pdf2.PDFSound(in); 53 } 54 55 60 public int getRate() 61 { 62 return sound.getRate(); 63 } 64 65 73 public String getType() 74 { 75 return sound.getType(); 76 } 77 78 82 public byte[] getStream() 83 { 84 try { 85 ByteArrayOutputStream out = new ByteArrayOutputStream(); 86 InputStream in = sound.getStream(); 87 byte[] b = new byte[1024]; 88 int flen; 89 while ((flen=in.read(b))>=0) { 90 out.write(b, 0, flen); 91 } 92 return out.toByteArray(); 93 } catch (IOException e) { throw new Error ("IOException writing to byte array: "+e); } 94 } 95 96 102 public void setMetaData(String xmldata) 103 { 104 sound.setMetaData(xmldata); 105 } 106 107 114 public Reader getMetaData() 115 throws IOException 116 { 117 return sound.getMetaData(); 118 } 119 } 120 | Popular Tags |