@Override public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); while (!compressor.needsInput()) { compress(); } }
@Override public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); } }
@Override public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); } }
@Override public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); } }
public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); while (!compressor.needsInput()) { compress(); } }
private boolean checkSetInputNullPointerException(Compressor compressor) { try { compressor.setInput(null, 0, 1); } catch (NullPointerException npe) { return true; } catch (Exception ex) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkSetInputNullPointerException error !!!")); } return false; }
private boolean checkSetInputArrayIndexOutOfBoundsException( Compressor compressor) { try { compressor.setInput(new byte[] { (byte) 0 }, 0, -1); } catch (ArrayIndexOutOfBoundsException e) { return true; } catch (Exception e) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkSetInputArrayIndexOutOfBoundsException error !!!")); } return false; }
private boolean checkSetInputNullPointerException(Compressor compressor) { try { compressor.setInput(null, 0, 1); } catch (NullPointerException npe) { return true; } catch (Exception ex) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkSetInputNullPointerException error !!!")); } return false; }
@Override public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); while (!compressor.needsInput()) { compress(); } }
@Override public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); while (!compressor.needsInput()) { compress(); } }
@Override public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); while (!compressor.needsInput()) { compress(); } }
public void write(byte[] b, int off, int len) throws IOException { // Sanity checks if (compressor.finished()) { throw new IOException("write beyond end of stream"); } if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } compressor.setInput(b, off, len); while (!compressor.needsInput()) { compress(); } }
private boolean checkSetInputArrayIndexOutOfBoundsException( Compressor compressor) { try { compressor.setInput(new byte[] { (byte) 0 }, 0, -1); } catch (ArrayIndexOutOfBoundsException e) { return true; } catch (Exception e) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkSetInputArrayIndexOutOfBoundsException error !!!")); } return false; }
private boolean checkCompressNullPointerException(Compressor compressor, byte[] rawData) { try { compressor.setInput(rawData, 0, rawData.length); compressor.compress(null, 0, 1); } catch (NullPointerException npe) { return true; } catch (Exception ex) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkCompressNullPointerException error !!!")); } return false; }
private boolean checkCompressNullPointerException(Compressor compressor, byte[] rawData) { try { compressor.setInput(rawData, 0, rawData.length); compressor.compress(null, 0, 1); } catch (NullPointerException npe) { return true; } catch (Exception ex) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkCompressNullPointerException error !!!")); } return false; }
private boolean checkCompressArrayIndexOutOfBoundsException( Compressor compressor, byte[] rawData) { try { compressor.setInput(rawData, 0, rawData.length); compressor.compress(new byte[rawData.length], 0, -1); } catch (ArrayIndexOutOfBoundsException e) { return true; } catch (Exception e) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkCompressArrayIndexOutOfBoundsException error !!!")); } return false; }
private boolean checkCompressArrayIndexOutOfBoundsException( Compressor compressor, byte[] rawData) { try { compressor.setInput(rawData, 0, rawData.length); compressor.compress(new byte[rawData.length], 0, -1); } catch (ArrayIndexOutOfBoundsException e) { return true; } catch (Exception e) { logger.error(joiner.join(compressor.getClass().getCanonicalName(), "checkCompressArrayIndexOutOfBoundsException error !!!")); } return false; }
private void flushBuffer() throws IOException { if (_bufferPosition > 0) { _compressor.reset(); _compressor.setInput(_buffer, 0, _bufferPosition); _compressor.finish(); long filePointer = _output.getFilePointer(); int length = _compressor.compress(_compressedBuffer, 0, _compressedBuffer.length); _tmpOutput.writeLong(filePointer); _blockCount++; _output.writeBytes(_compressedBuffer, 0, length); } }
private void flushBuffer() throws IOException { if (_bufferPosition > 0) { _compressor.reset(); _compressor.setInput(_buffer, 0, _bufferPosition); _compressor.finish(); long filePointer = _output.getFilePointer(); int length = _compressor.compress(_compressedBuffer, 0, _compressedBuffer.length); _tmpOutput.writeVLong(filePointer); _tmpOutput.writeVInt(length); _blockCount++; _output.writeBytes(_compressedBuffer, 0, length); } }