Package java.util.zip

Examples of java.util.zip.Adler32.update()


                byte []data = new byte[pageSize];
                if( recoveryFile.read(data, 0, pageSize) != pageSize ) {
                    // Invalid recovery record, Could not fully read the data". Probably due to a partial write to the recovery buffer
                    return nextTxId;
                }
                checksum.update(data, 0, pageSize);
                batch.put(offset, data);
            }
        } catch (Exception e) {
            // If an error occurred it was cause the redo buffer was not full written out correctly.. so don't redo it.
            // as the pages should still be consistent.
View Full Code Here


                if (length < 0)
                {
                    break;
                }

                checksum.update(buffer, 0, length);
            }

            is.close();

            // Reduces it down to just 32 bits which we express in hex.'
View Full Code Here

        byte[] buffer = new byte[4 * 1024];
        InputStream input = dataStore.readAt(HeaderItem.CHECKSUM_DATA_START_OFFSET);
        int bytesRead = input.read(buffer);
        while (bytesRead >= 0) {
            a32.update(buffer, 0, bytesRead);
            bytesRead = input.read(buffer);
        }

        // write checksum, utilizing logic in DexWriter to write the integer value properly
        OutputStream output = dataStore.outputAt(HeaderItem.CHECKSUM_OFFSET);
View Full Code Here

        message.writeTo(output);
        output.checkNoSpaceLeft();

        buffer.writerIndex(writerIndex + size);
        Adler32 checksum = new Adler32();
        checksum.update(buffer.array(), buffer.arrayOffset(), buffer.readableBytes());
        buffer.writeInt((int) checksum.getValue());
        return buffer;
    }
}
View Full Code Here

            ChannelBuffer buffer = (ChannelBuffer) obj;
            if (buffer.readableBytes() > 8) {
                String version = buffer.toString(buffer.readerIndex(), 4, Charset.defaultCharset());
                if (version.equals("RPC0")) {
                    Adler32 adler32 = new Adler32();
                    adler32.update(buffer.array(),
                            buffer.arrayOffset() + buffer.readerIndex(),
                            buffer.readableBytes() - 4);
                    buffer.markReaderIndex();
                    buffer.readerIndex(buffer.writerIndex() - 4);
                    int checksum = buffer.readInt();
View Full Code Here

        buffer.writeBytes(name.getBytes());
        buffer.writeZero(1);
        buffer.writeBytes(message.toByteArray());

        Adler32 checksum = new Adler32();
        checksum.update(buffer.array(), buffer.arrayOffset(), buffer.readableBytes());
        buffer.writeInt((int) checksum.getValue());

        return buffer;
    }
}
View Full Code Here

        return obj;
    }

    private boolean checksum(ChannelBuffer buffer) {
        Adler32 adler32 = new Adler32();
        adler32.update(buffer.array(),
                buffer.arrayOffset() + buffer.readerIndex(),
                buffer.readableBytes() - 4);
        buffer.markReaderIndex();
        buffer.readerIndex(buffer.writerIndex() - 4);
        int checksum = buffer.readInt();
View Full Code Here


  public long calculateChecksum() {
    Adler32 adler = new Adler32();
    for (Track track : tracks) {
      adler.update(track.getUUID());
      adler.update(0x01);
    }
    return adler.getValue();
  }
View Full Code Here

  public long calculateChecksum() {
    Adler32 adler = new Adler32();
    for (Track track : tracks) {
      adler.update(track.getUUID());
      adler.update(0x01);
    }
    return adler.getValue();
  }

  @Override
View Full Code Here

        header.putInt(blkId) ;
        header.flip() ;
        channel.write(header) ;
       
        Adler32 adler = new Adler32() ;
        adler.update(header.array()) ;

        if ( len > 0 )
        {
            // Make buffer include it's full length.
            // [TxDEV:TODO] This is the full buffer, junk and all.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.