diff --git a/data/.gitkeep b/data/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/logstash-core/src/main/java/org/logstash/common/io/InputStreamStreamInput.java b/logstash-core/src/main/java/org/logstash/common/io/InputStreamStreamInput.java index 712e42b87..002fad88c 100644 --- a/logstash-core/src/main/java/org/logstash/common/io/InputStreamStreamInput.java +++ b/logstash-core/src/main/java/org/logstash/common/io/InputStreamStreamInput.java @@ -24,7 +24,7 @@ public class InputStreamStreamInput extends StreamInput { public void readBytes(byte[] b, int offset, int len) throws IOException { if (len < 0) throw new IndexOutOfBoundsException(); - final int read = Streams.readFully(is, b, offset, len); + final int read = readFully(is, b, offset, len); if (read != len) { throw new EOFException(); } @@ -74,4 +74,16 @@ public class InputStreamStreamInput extends StreamInput { public long skip(long n) throws IOException { return is.skip(n); } + + private static int readFully(InputStream reader, byte[] dest, int offset, int len) throws IOException { + int read = 0; + while (read < len) { + final int r = reader.read(dest, offset + read, len - read); + if (r == -1) { + break; + } + read += r; + } + return read; + } } diff --git a/logstash-core/src/main/java/org/logstash/common/io/Streams.java b/logstash-core/src/main/java/org/logstash/common/io/Streams.java deleted file mode 100644 index a156640ab..000000000 --- a/logstash-core/src/main/java/org/logstash/common/io/Streams.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch 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.logstash.common.io; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; - -public abstract class Streams { - - public static int readFully(Reader reader, char[] dest) throws IOException { - return readFully(reader, dest, 0, dest.length); - } - - public static int readFully(Reader reader, char[] dest, int offset, int len) throws IOException { - int read = 0; - while (read < len) { - final int r = reader.read(dest, offset + read, len - read); - if (r == -1) { - break; - } - read += r; - } - return read; - } - - public static int readFully(InputStream reader, byte[] dest) throws IOException { - return readFully(reader, dest, 0, dest.length); - } - - public static int readFully(InputStream reader, byte[] dest, int offset, int len) throws IOException { - int read = 0; - while (read < len) { - final int r = reader.read(dest, offset + read, len - read); - if (r == -1) { - break; - } - read += r; - } - return read; - } -} -