GAE 不适用于:
import com.google.appengine.repackaged.com.google.common.base.Hash;
import com.google.appengine.repackaged.com.google.common.io.ByteStreams;
和我的代码:
byte[] inputBytes;
try {
inputBytes = ByteStreams.toByteArray(inputStream);
} catch (IOException err) {
logger.log(Level.WARNING, "Feed read error 1", err);
return null;
}
.....................
try {
return Long.toHexString(Hash.hash64(s.getBytes("UTF-8")));
} catch (UnsupportedEncodingException err) {
// UTF-8 is unlikely to be unsupported
不再起作用,我该如何修复它?
尝试过:
import com.google.common.io.ByteStreams;
import com.google.common.base.Hash;
但 IDE 说:
The import com.google.common.io cannot be resolved
The import com.google.common.base.Hash cannot be resolved
最佳答案
您不应该自己使用重新打包的
类 - 它们是为了提供供 SDK 使用的稳定版本的库,而不会干扰您自己的副本。在您的应用中包含您自己的副本,然后使用它。
关于java - GAE的base.Hash和io.ByteStreams,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8580597/