你如果只是简单得想知道写入的bytes的大小,那么就可以用.size()方法得到写入的bytes数量。
但是如果你要得到写入的具体的bytes的内容,那么就不能光使用DataOutputStream了。ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);//write some data to the data output stream//then get the bytes in the byte array output stream, that is, what you write.
byte [] data = baos.toByteArray();//then you can deal with the bytes array you get and transform it into any information you need