Public byte[] Stream2byte (String infile) {
bufferedinputstream in = null;
Bytearrayoutputstream out = null;
try {in
= new Bufferedinputstream (new FileInputStream (infile));
out = new Bytearrayoutputstream (1024);
System.out.println ("Available bytes:" + in.available ());
byte[] temp = new byte[1024];
int size = 0;
while (size = In.read (temp))!=-1) {
out.write (temp, 0, size);
}
catch (Exception e) {
e.printstack Trace ();
} Finally {
try {
in.close ();
} catch (IOException e) {
e.printstacktrace ();
}
} byte[] content = Out.tobytearray ();
System.out.println ("readed bytes Count:" + content.length);
return content;
}
protected static byte[] ReadContent (final inputstream in) throws IOException {Bytearrayoutputstream b
out = new Bytearrayoutputstream ();
byte[] buf = new Byte[size_input_buffer];
int c = 0;
int b = 0;
while ((C < buf.length) && (b = In.read (buf, C, buf.length-c)) >= 0) {c = b;
if (c = = Size_input_buffer) {bout.write (BUF);
BUF = new Byte[size_input_buffer];
c = 0;
} if (c!= 0) {bout.write (buf, 0, C);
return Bout.tobytearray (); }