Java ByteInputStream Problem

已取消 已发布的 Jan 29, 2009 货到付款
已取消 货到付款

I have some java code which reads in data from a file and parses it as follows: DataInputStream dis; byte[] packet; int start_offs; [url removed, login to view] = new DataInputStream(new ByteArrayInputStream(packet, start_offs, [url removed, login to view])); the code does: byte ContentType = [url removed, login to view](); to get the next piece of data as needed. Now, I need to keep this code to read the data from a file but there is another case where I have the Byte Array already in memory and do not need to read it into a file. How can I get the DataInputStream to use that Byte Array and read it as if it were a ByteArrayInputStream? I do not want to write the byte array out into a file & read it in again.

工程 Java 微软 MySQL PHP 软件构架 软件测试 视窗桌面

项目ID: #3588658

关于项目

5个方案 远程项目 活跃的Jan 29, 2009

有5名威客正在参与此工作的竞标,均价$6/小时

TopOfStack

See private message.

$4.25USD 在1天里
(192条评论)
7.3
ricks7

See private message.

$8.5USD 在1天里
(88条评论)
5.2
egycodersvw

See private message.

$6.8USD 在1天里
(45条评论)
4.6
hirshah25

See private message.

$3.4USD 在1天里
(7条评论)
2.5
nadimpalliramesh

See private message.

$6.8USD 在1天里
(0条评论)
0.0