Home | History | Annotate | Download | only in shadows
      1 package org.robolectric.shadows;
      2 
      3 import static java.nio.charset.StandardCharsets.UTF_8;
      4 
      5 import java.io.IOException;
      6 import java.nio.file.Files;
      7 import java.nio.file.Paths;
      8 import libcore.io.IoUtils;
      9 import org.robolectric.annotation.Implementation;
     10 import org.robolectric.annotation.Implements;
     11 
     12 @Implements(value = IoUtils.class, isInAndroidSdk = false)
     13 public class ShadowIoUtils {
     14 
     15   @Implementation
     16   public static String readFileAsString(String absolutePath) throws IOException {
     17     return new String(Files.readAllBytes(Paths.get(absolutePath)), UTF_8);
     18   }
     19 }
     20