1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tradefed.device; 18 19 import com.android.tradefed.result.InputStreamSource; 20 21 /** 22 * A class that provides the output of a device's logcat as an {@link InputStreamSource}. 23 */ 24 public interface ILogcatReceiver { 25 start()26 public void start(); 27 stop()28 public void stop(); 29 clear()30 public void clear(); 31 getLogcatData()32 public InputStreamSource getLogcatData(); 33 getLogcatData(int maxBytes)34 public InputStreamSource getLogcatData(int maxBytes); 35 36 /** 37 * Returns the current logcat buffer given an offset. 38 * 39 * @param maxBytes The max size of the returned buffer 40 * @param offset The offset of the full buffer. 41 * @return The logcat buffer starting at the offset. 42 */ getLogcatData(int maxBytes, int offset)43 public default InputStreamSource getLogcatData(int maxBytes, int offset) { 44 return getLogcatData(maxBytes); 45 } 46 } 47 48