@@ -534,16 +534,16 @@ public static void bufInputToOutput(InputStream inputStream, OutputStream output
534
534
* @return 制限サイズを超えた場合は-1、それ以外はサイズ
535
535
* @throws IOException 例外
536
536
*/
537
- @ Range (from = -1 , to = Integer .MAX_VALUE )
538
- public static int inputToOutputLimit (@ NotNull InputStream inputStream , @ NotNull OutputStream outputStream , @ Range (from = 0 , to = Integer .MAX_VALUE ) int readSize , @ Range (from = 0 , to = Integer .MAX_VALUE ) int limit ) throws IOException {
539
- int ct = 0 ;
537
+ @ Range (from = -1 , to = Long .MAX_VALUE )
538
+ public static long inputToOutputLimit (@ NotNull InputStream inputStream , @ NotNull OutputStream outputStream , @ Range (from = 0 , to = Integer .MAX_VALUE ) int readSize , @ Range (from = 0 , to = Long .MAX_VALUE ) long limit ) throws IOException {
539
+ long ct = 0 ;
540
540
boolean flg = false ;
541
541
try (InputStream in = inputStream ; OutputStream out = outputStream ) {
542
542
byte [] data = new byte [readSize ];
543
543
int len ;
544
544
while (!flg && (len = in .read (data )) != -1 ) {
545
545
if ((ct + len ) > limit ) {
546
- len = limit - ct ;
546
+ len = ( int ) ( limit - ct ) ;
547
547
flg = true ;
548
548
}
549
549
ct += len ;
@@ -564,8 +564,8 @@ public static int inputToOutputLimit(@NotNull InputStream inputStream, @NotNull
564
564
* @return 制限サイズを超えた場合は-1、それ以外はサイズ
565
565
* @throws IOException 例外
566
566
*/
567
- @ Range (from = -1 , to = Integer .MAX_VALUE )
568
- public static int inputToOutputLimit (@ NotNull InputStream inputStream , @ NotNull OutputStream outputStream , @ Range (from = 0 , to = Integer .MAX_VALUE ) int limit ) throws IOException {
567
+ @ Range (from = -1 , to = Long .MAX_VALUE )
568
+ public static long inputToOutputLimit (@ NotNull InputStream inputStream , @ NotNull OutputStream outputStream , @ Range (from = 0 , to = Long .MAX_VALUE ) long limit ) throws IOException {
569
569
return inputToOutputLimit (inputStream , outputStream , 1024 , limit );
570
570
}
571
571
0 commit comments