Home | History | Annotate | Download | only in result
      1 /*
      2  * Copyright (C) 2013 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 package com.android.tradefed.result;
     17 
     18 /**
     19  * Class to hold the metadata for a saved log file.
     20  */
     21 public class LogFile {
     22     private final String mPath;
     23     private final String mUrl;
     24     private final boolean mIsText;
     25     private final boolean mIsCompressed;
     26 
     27     /**
     28      * Construct a {@link LogFile} with filepath and URL metadata.
     29      *
     30      * @param path The absolute path to the saved file.
     31      * @param url The URL where the saved file can be accessed.
     32      * @deprecated use {@link #LogFile(String, String, boolean, boolean)} instead.
     33      */
     34     @Deprecated
     35     public LogFile(String path, String url) {
     36         this(path, url, false, false);
     37     }
     38 
     39     /**
     40      * Construct a {@link LogFile} with filepath, URL, and {@link LogDataType} metadata.
     41      *
     42      * @param path The absolute path to the saved file.
     43      * @param url The URL where the saved file can be accessed.
     44      * @param compressed Whether the saved file is compressed.
     45      * @param text Whether the saved file can be displayed as text.
     46      */
     47     public LogFile(String path, String url, boolean compressed, boolean text) {
     48         mPath = path;
     49         mUrl = url;
     50         mIsCompressed = compressed;
     51         mIsText = text;
     52     }
     53 
     54     /**
     55      * Get the absolute path.
     56      */
     57     public String getPath() {
     58         return mPath;
     59     }
     60 
     61     /**
     62      * Get the URL where the saved file can be accessed.
     63      */
     64     public String getUrl() {
     65         return mUrl;
     66     }
     67 
     68     /**
     69      * Get whether the file can be displayed as text.
     70      */
     71     public boolean isText() {
     72         return mIsText;
     73     }
     74 
     75     /**
     76      * Get whether the file is compressed.
     77      */
     78     public boolean isCompressed() {
     79         return mIsCompressed;
     80     }
     81 }
     82