3 import java
.io
.ByteArrayOutputStream
;
4 import java
.io
.IOException
;
5 import java
.io
.InputStream
;
9 public class Song
extends Response
{
11 private final byte[] song
;
13 public Song(byte[] song
) {
14 super(null, Response
.OK
);
19 public Song(InputStream in
, int length
) throws IOException
{
20 super(null, Response
.OK
);
22 ByteArrayOutputStream str
= new ByteArrayOutputStream(length
);
23 byte[] buf
= new byte[256];
25 int read
= in
.read(buf
, 0, 256);
26 if (read
> 0) str
.write(buf
, 0, read
);
27 else if (read
== -1) break;
30 song
= str
.toByteArray();
33 public byte[] song() {