MCPcopy Create free account
hub / github.com/zhuker/lamejs / encodeBuffer

Method encodeBuffer

src/main/java/lowlevel/LameEncoder.java:461–475  ·  view source on GitHub ↗

Encode a block of data. Throws IllegalArgumentException when parameters are wrong. When the encoded array is too small, an ArrayIndexOutOfBoundsException is thrown. length should be the value returned by getPCMBufferSize. @return the number of bytes written to encode

(byte[] pcm, int offset, int length, byte[] encoded)

Source from the content-addressed store, hash-verified

459 * @return the number of bytes written to <code>encoded</code>. May be 0.
460 */
461 public int encodeBuffer(byte[] pcm, int offset, int length, byte[] encoded)
462 throws ArrayIndexOutOfBoundsException {
463 if (length < 0 || (offset + length) > pcm.length) {
464 throw new IllegalArgumentException("inconsistent parameters");
465 }
466 int result = doEncodeBuffer(pcm, offset, length, encoded);
467 if (result < 0) {
468 if (result == -1) {
469 throw new ArrayIndexOutOfBoundsException(
470 "Encode buffer too small");
471 }
472 throw new RuntimeException("crucial error in encodeBuffer.");
473 }
474 return result;
475 }
476
477 public int encodeFinish(byte[] encoded) {
478 return lame.lame_encode_flush(gfp, encoded, 0, encoded.length);

Callers 4

encodeFunction · 0.80
encodeFunction · 0.80
testFullLengthFunction · 0.80
testStereo44100Function · 0.80

Calls 1

doEncodeBufferMethod · 0.95

Tested by

no test coverage detected