001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.terminal.region; 018 019/** 020 * Receives a notice that a terminal's bytes have grown. 021 * 022 * <p> 023 * Sources such as {@link MemoryTerminalSource} and {@link TerminalProcess} call this after bytes are appended and once 024 * more when no further bytes will arrive. It is a hint only: a reader still fetches the bytes through 025 * {@link TerminalSource#read(long, int)}. 026 * 027 * <p> 028 * Implementations must not block and must not throw; callers still guard against a throwing implementation. 029 */ 030@FunctionalInterface 031public interface TerminalNudgePublisher { 032 033 /** 034 * Reports that a terminal's bytes now end at an offset. 035 * 036 * @param terminalId The terminal id. 037 * @param end The offset one past the last byte appended so far. 038 * @param done <jk>true</jk> if no more bytes will be appended. 039 */ 040 void nudge(String terminalId, long end, boolean done); 041}