我正在研究DNA蛋白質對齊項目「readseq」。其「flybase」包中包含具有「charToByteConverter」類的java代碼,該類不會編譯並且提供「類型已棄用」消息。 (http://iubio.bio.indiana.edu/soft/molbio/readseq/java/)。 Here readseq source can be found我需要在此應用程序中添加更多功能,不知道如何解決它以實現我的目標。我在java中是一種新的bie。如果可能,請提供幫助。 Readseq與它的gui很容易上網。 它只是將給定字符的數組轉換爲字節。以下是關於它的一些信息:(docjar.com/docs/api/sun/io/CharToByteConverter.html)。我不知道該如何處理這個被棄用的問題。 它是用來作爲下一個抽象類:Java類chartobyteconverter類型不建議使用
protected byte[] getBytes(CharToByteConverter ctb) {
ctb.reset();
int estLength = ctb.getMaxBytesPerChar() * count;
byte[] result = new byte[estLength];
int length;
try {
length = ctb.convert(value, offset, offset + count,
result, 0, estLength);
length += ctb.flush(result, ctb.nextByteIndex(), estLength);
} catch (CharConversionException e) {
length = ctb.nextByteIndex();
}
if (length < estLength) {
// A short format was used: Trim the byte array.
byte[] trimResult = new byte[length];
System.arraycopy(result, 0, trimResult, 0, length);
return trimResult;
}
else {
return result;
}
}
什麼是 「CharToByteConverter的」 做什麼呢?我想這不僅僅是從Java字符轉換爲Java字節...... –
它只是將給定字符的數組轉換爲字節。以下是關於它的一些信息:(http://www.docjar.com/docs/api/sun/io/CharToByteConverter.html)。我不知道該如何處理這個被棄用的問題。 – Martin