public void readFields(DataInput in) throws IOException{
//How can I set up the byteArray size here?
//DataInput does not have available() or length() method.
byte[] videoByteArray = new byte[size];
in.readFully(videoByteArray);
}
如何知道DataInput的大小?在我將所有數據讀入字節數組之前,我需要先設置大小。我怎樣才能知道DataInput的大小?
你不知道大小。看到下面的鏈接,不介意不同的標題。請閱讀所有的注意事項http://stackoverflow.com/questions/7576908/convert-datainput-to-datainputstream –
我完全同意DataInput糟糕 - 這不是流,所以爲什麼不接口定義長度/大小的方法? ARG。 – ib84