diff --git a/hbase-protocol/src/main/java/com/google/protobuf/PublicVersionOfLimitInputStream.java b/hbase-protocol/src/main/java/com/google/protobuf/PublicVersionOfLimitInputStream.java new file mode 100644 index 0000000..cc23d55 --- /dev/null +++ b/hbase-protocol/src/main/java/com/google/protobuf/PublicVersionOfLimitInputStream.java @@ -0,0 +1,84 @@ +package com.google.protobuf; + +/** +* 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. +*/ +import java.io.IOException; +import java.io.InputStream; + +import com.google.protobuf.AbstractMessageLite.Builder.LimitedInputStream; + +/** + * A public version of {@link LimitedInputStream}. {@link LimitedInputStream} is package protected and final but the + * facility is useful doing pb stuff. This class is a wrapper around a LIS instance. + * @since 0.98 + */ +public class PublicVersionOfLimitInputStream { + private final LimitedInputStream delegatee; + + public PublicVersionOfLimitInputStream(InputStream in, int limit) { + this.delegatee = new LimitedInputStream(in, limit); + } + + public int available() throws IOException { + return delegatee.available(); + } + + public void close() throws IOException { + delegatee.close(); + } + + public boolean equals(Object obj) { + return delegatee.equals(obj); + } + + public int hashCode() { + return delegatee.hashCode(); + } + + public void mark(int arg0) { + delegatee.mark(arg0); + } + + public boolean markSupported() { + return delegatee.markSupported(); + } + + public int read() throws IOException { + return delegatee.read(); + } + + public int read(byte[] b, int off, int len) throws IOException { + return delegatee.read(b, off, len); + } + + public int read(byte[] arg0) throws IOException { + return delegatee.read(arg0); + } + + public void reset() throws IOException { + delegatee.reset(); + } + + public long skip(long n) throws IOException { + return delegatee.skip(n); + } + + public String toString() { + return delegatee.toString(); + } +} \ No newline at end of file