| 226 | } |
| 227 | |
| 228 | @Override |
| 229 | public void decompress(ByteBuffer in, ByteBuffer out) throws IOException { |
| 230 | if (in.isDirect() && out.isDirect()) { |
| 231 | directDecompress(in, out); |
| 232 | return; |
| 233 | } |
| 234 | |
| 235 | int srcOffset = in.arrayOffset() + in.position(); |
| 236 | int srcSize = in.remaining(); |
| 237 | int dstOffset = out.arrayOffset() + out.position(); |
| 238 | int dstSize = out.remaining() - dstOffset; |
| 239 | |
| 240 | long decompressOut = |
| 241 | Zstd.decompressByteArray(out.array(), dstOffset, dstSize, in.array(), |
| 242 | srcOffset, srcSize); |
| 243 | in.position(in.limit()); |
| 244 | out.position(dstOffset + (int) decompressOut); |
| 245 | out.flip(); |
| 246 | } |
| 247 | |
| 248 | @Override |
| 249 | public boolean isAvailable() { |