-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: remove PGStream.streamBuffer and reuse PgBufferedOutputStream's…
… buffer when sending data from InputStream
- Loading branch information
Showing
5 changed files
with
256 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
pgjdbc/src/main/java/org/postgresql/util/internal/SourceStreamIOException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2024, PostgreSQL Global Development Group | ||
* See the LICENSE file in the project root for more information. | ||
*/ | ||
|
||
package org.postgresql.util.internal; | ||
|
||
import static org.postgresql.util.internal.Nullness.castNonNull; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* A marker exception class to distinguish between "IOException when reading the data" and | ||
* "IOException when writing the data" when transferring data from one stream to another. | ||
*/ | ||
public class SourceStreamIOException extends IOException { | ||
/** | ||
* The number of bytes remaining to transfer to the destination stream. | ||
*/ | ||
private final int bytesRemaining; | ||
|
||
public SourceStreamIOException(int bytesRemaining, IOException cause) { | ||
super(cause); | ||
this.bytesRemaining = bytesRemaining; | ||
} | ||
|
||
public int getBytesRemaining() { | ||
return bytesRemaining; | ||
} | ||
|
||
@Override | ||
public synchronized IOException getCause() { | ||
return (IOException) castNonNull(super.getCause()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters