Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2012 the project-owners Licensed 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 inti.util;
 
InputStream which notifies on reads and closes.
 
 public class NotifyingInputStream extends InputStream {
    
    
Notifier interface for input streams.
 
     public interface ReadNotifier {
         
         void read(int b);
         
         void read(byte[] dataint offsetint length);
         
         void close();
         
     }
     
     InputStream source;
     
     @Override
     public int read() throws IOException {
         int data = .read();
         .read(data);
         return data;
     }
     
     @Override
     public int read(byte[] bint offint lenthrows IOException {
         int dataRead = .read(bofflen);
         .read(boffdataRead);
         return dataRead;
     }
     
     @Override
     public int available() throws IOException {
         return .available();
     }
     
     @Override
     public void close() throws IOException {
         .close();
         .close();
     }
     
     @Override
     public void mark(int readlimit) {
         .mark(readlimit);
     }
     
     @Override
     public boolean markSupported() {
         return .markSupported();
     }
     
     @Override
     public void reset() throws IOException {
         .reset();
     }
     
     @Override
     public long skip(long nthrows IOException {
         return .skip(n);
     }
     
     public InputStream getSource() {
         return ;
     }
     
     public void setSource(InputStream source) {
         this. = source;
     }
     
     public ReadNotifier getNotifier() {
         return ;
     }
     
     public void setNotifier(ReadNotifier notifier) {
        this. = notifier;
    }
    
New to GrepCode? Check out our FAQ X