1 /* 2 * Copyright 2022 Google LLC 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.google.android.libraries.mobiledatadownload.file.common.testing; 17 18 import android.net.Uri; 19 import com.google.android.libraries.mobiledatadownload.file.spi.Transform; 20 import java.io.IOException; 21 import java.io.InputStream; 22 import java.io.OutputStream; 23 24 /** Dummy transform specs for testing. */ 25 public class DummyTransforms { 26 27 public static final Transform CAP_FILENAME_TRANSFORM = 28 new Transform() { 29 @Override 30 public String name() { 31 return "cap"; 32 } 33 34 @Override 35 public InputStream wrapForRead(Uri uri, InputStream wrapped) throws IOException { 36 return wrapped; 37 } 38 39 @Override 40 public OutputStream wrapForWrite(Uri uri, OutputStream wrapped) throws IOException { 41 return wrapped; 42 } 43 44 @Override 45 public OutputStream wrapForAppend(Uri uri, OutputStream wrapped) throws IOException { 46 return wrapped; 47 } 48 49 @Override 50 public String encode(Uri uri, String filename) { 51 return filename.toUpperCase(); 52 } 53 }; 54 } 55