You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by he...@apache.org on 2022/05/06 10:47:16 UTC

[incubator-inlong] branch master updated: [INLONG-4086][Sort] Remove BufferedSocketInputStream class as it is not used (#4087)

This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new dae945eb5 [INLONG-4086][Sort] Remove BufferedSocketInputStream class as it is not used (#4087)
dae945eb5 is described below

commit dae945eb586f46b9d9b3f813ac91187d0e5e0350
Author: Schnapps <zp...@connect.ust.hk>
AuthorDate: Fri May 6 18:47:10 2022 +0800

    [INLONG-4086][Sort] Remove BufferedSocketInputStream class as it is not used (#4087)
---
 .../flink/cdc/io/BufferedSocketInputStream.java    | 80 ----------------------
 1 file changed, 80 deletions(-)

diff --git a/inlong-sort/sort-single-tenant/src/main/java/org/apache/inlong/sort/singletenant/flink/cdc/io/BufferedSocketInputStream.java b/inlong-sort/sort-single-tenant/src/main/java/org/apache/inlong/sort/singletenant/flink/cdc/io/BufferedSocketInputStream.java
deleted file mode 100644
index c03ed53c4..000000000
--- a/inlong-sort/sort-single-tenant/src/main/java/org/apache/inlong/sort/singletenant/flink/cdc/io/BufferedSocketInputStream.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.inlong.sort.singletenant.flink.cdc.io;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Copied from https://github.com/osheroff/mysql-binlog-connector-java project to fix
- * https://github.com/ververica/flink-cdc-connectors/issues/460.
- *
- * <p>Line 50 and Line 70 ~ 72: Returns -1 means reach the end of InputStream. We should remove this
- * class after we bumped a higher mysql-binlog-connector-java version where the
- * https://github.com/osheroff/mysql-binlog-connector-java/issues/66 has been fixed.
- */
-public class BufferedSocketInputStream extends FilterInputStream {
-
-    private byte[] buffer;
-    private int offset;
-    private int limit;
-
-    public BufferedSocketInputStream(InputStream in) {
-        this(in, 512 * 1024);
-    }
-
-    public BufferedSocketInputStream(InputStream in, int bufferSize) {
-        super(in);
-        this.buffer = new byte[bufferSize];
-    }
-
-    @Override
-    public int available() throws IOException {
-        return limit == -1 ? in.available() : limit - offset + in.available();
-    }
-
-    @Override
-    public int read() throws IOException {
-        if (offset < limit) {
-            return buffer[offset++] & 0xff;
-        }
-        offset = 0;
-        limit = in.read(buffer, 0, buffer.length);
-        return limit != -1 ? buffer[offset++] & 0xff : -1;
-    }
-
-    @Override
-    public int read(byte[] b, int off, int len) throws IOException {
-        if (offset >= limit) {
-            if (len >= buffer.length) {
-                return in.read(b, off, len);
-            }
-            offset = 0;
-            limit = in.read(buffer, 0, buffer.length);
-            if (limit == -1) {
-                return limit;
-            }
-        }
-        int bytesRemainingInBuffer = Math.min(len, limit - offset);
-        System.arraycopy(buffer, offset, b, off, bytesRemainingInBuffer);
-        offset += bytesRemainingInBuffer;
-        return bytesRemainingInBuffer;
-    }
-}