@@ -534,16 +534,16 @@ public static void bufInputToOutput(InputStream inputStream, OutputStream output
534534 * @return 制限サイズを超えた場合は-1、それ以外はサイズ
535535 * @throws IOException 例外
536536 */
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 ;
540540 boolean flg = false ;
541541 try (InputStream in = inputStream ; OutputStream out = outputStream ) {
542542 byte [] data = new byte [readSize ];
543543 int len ;
544544 while (!flg && (len = in .read (data )) != -1 ) {
545545 if ((ct + len ) > limit ) {
546- len = limit - ct ;
546+ len = ( int ) ( limit - ct ) ;
547547 flg = true ;
548548 }
549549 ct += len ;
@@ -564,8 +564,8 @@ public static int inputToOutputLimit(@NotNull InputStream inputStream, @NotNull
564564 * @return 制限サイズを超えた場合は-1、それ以外はサイズ
565565 * @throws IOException 例外
566566 */
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 {
569569 return inputToOutputLimit (inputStream , outputStream , 1024 , limit );
570570 }
571571
0 commit comments