mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8282648: Weaken the InflaterInputStream specification in order to allow faster Zip implementations
Reviewed-by: lancea, alanb, jpai, mr, darcy
This commit is contained in:
parent
e31c537f05
commit
2c61efe3de
7 changed files with 82 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -92,13 +92,24 @@ public class GZIPInputStream extends InflaterInputStream {
|
|||
}
|
||||
|
||||
/**
|
||||
* Reads uncompressed data into an array of bytes. If {@code len} is not
|
||||
* zero, the method will block until some input can be decompressed; otherwise,
|
||||
* no bytes are read and {@code 0} is returned.
|
||||
* Reads uncompressed data into an array of bytes, returning the number of inflated
|
||||
* bytes. If {@code len} is not zero, the method will block until some input can be
|
||||
* decompressed; otherwise, no bytes are read and {@code 0} is returned.
|
||||
* <p>
|
||||
* If this method returns a nonzero integer <i>n</i> then {@code buf[off]}
|
||||
* through {@code buf[off+}<i>n</i>{@code -1]} contain the uncompressed
|
||||
* data. The content of elements {@code buf[off+}<i>n</i>{@code ]} through
|
||||
* {@code buf[off+}<i>len</i>{@code -1]} is undefined, contrary to the
|
||||
* specification of the {@link java.io.InputStream InputStream} superclass,
|
||||
* so an implementation is free to modify these elements during the inflate
|
||||
* operation. If this method returns {@code -1} or throws an exception then
|
||||
* the content of {@code buf[off]} through {@code buf[off+}<i>len</i>{@code
|
||||
* -1]} is undefined.
|
||||
*
|
||||
* @param buf the buffer into which the data is read
|
||||
* @param off the start offset in the destination array {@code b}
|
||||
* @param off the start offset in the destination array {@code buf}
|
||||
* @param len the maximum number of bytes read
|
||||
* @return the actual number of bytes read, or -1 if the end of the
|
||||
* @return the actual number of bytes inflated, or -1 if the end of the
|
||||
* compressed input stream is reached
|
||||
*
|
||||
* @throws NullPointerException If {@code buf} is {@code null}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue