• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FileSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中okhttp3.internal.io.FileSystem的典型用法代码示例。如果您正苦于以下问题:Java FileSystem类的具体用法?Java FileSystem怎么用?Java FileSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileSystem类属于okhttp3.internal.io包,在下文中一共展示了FileSystem类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: create

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
/**
 * Create a cache which will reside in {@code directory}. This cache is lazily initialized on
 * first access and will be created if it does not exist.
 *
 * @param directory a writable directory
 * @param valueCount the number of values per cache entry. Must be positive.
 * @param maxSize the maximum number of bytes this cache should use to store
 */
public static DiskLruCache create(FileSystem fileSystem, File directory, int appVersion,
    int valueCount, long maxSize) {
  if (maxSize <= 0) {
    throw new IllegalArgumentException("maxSize <= 0");
  }
  if (valueCount <= 0) {
    throw new IllegalArgumentException("valueCount <= 0");
  }

  // Use a single background thread to evict entries.
  Executor executor = new ThreadPoolExecutor(0, 1, 60L, TimeUnit.SECONDS,
      new LinkedBlockingQueue<Runnable>(), Util.threadFactory("OkHttp DiskLruCache", true));

  return new DiskLruCache(fileSystem, directory, appVersion, valueCount, maxSize, executor);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:DiskLruCache.java


示例2: prefetchFileSystemWriteFailure

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
@Test public void prefetchFileSystemWriteFailure() throws IOException {
  FaultyHttpCacheStore faultyCacheStore = new FaultyHttpCacheStore(FileSystem.SYSTEM);
  cacheStore.delegate = faultyCacheStore;

  faultyCacheStore.failStrategy(FaultyHttpCacheStore.FailStrategy.FAIL_HEADER_WRITE);
  server.enqueue(mockResponse("HttpCacheTestAllPlanets.json"));

  Rx2Apollo.from(apolloClient.prefetch(new AllPlanetsQuery()))
      .test()
      .awaitDone(TIME_OUT_SECONDS, TimeUnit.SECONDS)
      .assertError(Exception.class);
  checkNoCachedResponse();

  server.enqueue(mockResponse("HttpCacheTestAllPlanets.json"));
  faultyCacheStore.failStrategy(FaultyHttpCacheStore.FailStrategy.FAIL_BODY_WRITE);
  Rx2Apollo.from(apolloClient.prefetch(new AllPlanetsQuery()))
      .test()
      .awaitDone(TIME_OUT_SECONDS, TimeUnit.SECONDS)
      .assertError(Exception.class);
  checkNoCachedResponse();
}
 
开发者ID:apollographql,项目名称:apollo-android,代码行数:22,代码来源:ApolloPrefetchTest.java


示例3: DiskLruCache

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
DiskLruCache(FileSystem fileSystem, File directory, int appVersion, int valueCount, long maxSize,
    Executor executor) {
  this.fileSystem = fileSystem;
  this.directory = directory;
  this.appVersion = appVersion;
  this.journalFile = new File(directory, JOURNAL_FILE);
  this.journalFileTmp = new File(directory, JOURNAL_FILE_TEMP);
  this.journalFileBackup = new File(directory, JOURNAL_FILE_BACKUP);
  this.valueCount = valueCount;
  this.maxSize = maxSize;
  this.executor = executor;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:DiskLruCache.java


示例4: LruDisk

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
@SuppressWarnings("ResultOfMethodCallIgnored")
LruDisk(File path, int version, int valueCount, int maxSize) {
    if (!path.exists()) {
        path.mkdirs();
    }
    gson = new Gson();
    diskLruCache = DiskLruCache.create(FileSystem.SYSTEM, path, version, valueCount, maxSize);
}
 
开发者ID:7449,项目名称:RxNetWork,代码行数:9,代码来源:LruDisk.java


示例5: SimpleCache

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
public SimpleCache(File directory, long maxSize) {
    cache = DiskLruCache.create(FileSystem.SYSTEM, directory, VERSION, 2, maxSize);
}
 
开发者ID:lifechurch,项目名称:nuclei-android,代码行数:4,代码来源:SimpleCache.java


示例6: createInMemoryCache

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
private static Cache createInMemoryCache() {
  try {
    final Constructor<Cache> constructor =
      Cache.class.getDeclaredConstructor(File.class, Long.TYPE, FileSystem.class);
    constructor.setAccessible(true);
    return constructor.newInstance(
      new File(".virtual"), 128*1024*1024, new InMemoryFileSystem()
    );
  }
  catch (final Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:programingjd,项目名称:okserver,代码行数:14,代码来源:CacheTest.java


示例7: fileSystemWriteFailure

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
@Test public void fileSystemWriteFailure() throws Exception {
  enqueueResponse("/ShopWithCollections.json");

  FaultyCacheStore faultyCacheStore = new FaultyCacheStore(FileSystem.SYSTEM);
  cacheStore.delegate = faultyCacheStore;

  faultyCacheStore.failStrategy(FaultyCacheStore.FailStrategy.FAIL_HEADER_WRITE);
  GraphResponse response = graphClient.queryGraph(Storefront.query(new ShopWithCollectionsQuery()))
    .cachePolicy(HttpCachePolicy.NETWORK_FIRST.expireAfter(10, TimeUnit.SECONDS))
    .execute();
  assertThat(server.getRequestCount()).isEqualTo(1);
  assertThat(lastHttResponse.cacheResponse()).isNull();
  assertThat(response.hasErrors()).isFalse();
  assertThat(response.data()).isNotNull();
  checkNoCachedResponse();

  enqueueResponse("/ShopWithCollections.json");
  faultyCacheStore.failStrategy(FaultyCacheStore.FailStrategy.FAIL_BODY_WRITE);
  response = graphClient.queryGraph(Storefront.query(new ShopWithCollectionsQuery()))
    .cachePolicy(HttpCachePolicy.NETWORK_FIRST.expireAfter(10, TimeUnit.SECONDS))
    .execute();
  assertThat(server.getRequestCount()).isEqualTo(2);
  assertThat(lastHttResponse.cacheResponse()).isNull();
  assertThat(response.hasErrors()).isFalse();
  assertThat(response.data()).isNotNull();
  checkNoCachedResponse();
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:28,代码来源:CacheTest.java


示例8: Cache

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
public Cache(File directory, long maxSize) {
  this(directory, maxSize, FileSystem.SYSTEM);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Cache.java


示例9: FaultyFileSystem

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
public FaultyFileSystem(FileSystem delegate) {
  this.delegate = delegate;
}
 
开发者ID:lizhangqu,项目名称:PriorityOkHttp,代码行数:4,代码来源:FaultyFileSystem.java


示例10: Cache

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
public Cache(File directory, long maxSize) {
    this(directory, maxSize, FileSystem.SYSTEM);
}
 
开发者ID:RunningTheSnail,项目名称:Okhttp,代码行数:4,代码来源:Cache.java


示例11: PicassoCardRequestHandler

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
private PicassoCardRequestHandler() {
    File file = new File(ArcaneTrackerApplication.getContext().getCacheDir(), "cardsCache");
    cache = DiskLruCache.create(FileSystem.SYSTEM, file, VERSION, ENTRY_COUNT, 250 * 1024*1024);
}
 
开发者ID:HearthSim,项目名称:arcane_tracker,代码行数:5,代码来源:PicassoCardRequestHandler.java


示例12: DiskLruHttpCacheStore

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
public DiskLruHttpCacheStore(@Nonnull File directory, long maxSize) {
  this.cache = DiskLruCache.create(FileSystem.SYSTEM, directory, VERSION, ENTRY_COUNT, maxSize);
}
 
开发者ID:apollographql,项目名称:apollo-android,代码行数:4,代码来源:DiskLruHttpCacheStore.java


示例13: FaultyHttpCacheStore

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
FaultyHttpCacheStore(FileSystem fileSystem) {
  this.cache = DiskLruCache.create(fileSystem, new File("/cache/"), VERSION, ENTRY_COUNT, Integer.MAX_VALUE);
}
 
开发者ID:apollographql,项目名称:apollo-android,代码行数:4,代码来源:FaultyHttpCacheStore.java


示例14: ImageCache

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
private ImageCache(Context context) {
    mDiskCache = DiskLruCache.create(FileSystem.SYSTEM, new File(context.getCacheDir(), context.getString(R.string.image_cache_name)),
            BuildConfig.VERSION_CODE, 1, R.integer.google_plus_contact_image_cache_max_size);
    mCache = new LruCache<>(R.integer.google_plus_contacts_cache_size);
}
 
开发者ID:asmolko,项目名称:MyDebts,代码行数:6,代码来源:ImageCache.java


示例15: DiskLruCacheStore

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
DiskLruCacheStore(@NonNull final File directory, final long maxSize) {
  this.cache = DiskLruCache.create(FileSystem.SYSTEM, directory, VERSION, ENTRY_COUNT, maxSize);
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:4,代码来源:DiskLruCacheStore.java


示例16: FaultyCacheStore

import okhttp3.internal.io.FileSystem; //导入依赖的package包/类
FaultyCacheStore(FileSystem fileSystem) {
  this.cache = DiskLruCache.create(fileSystem, new File("/cache/"), VERSION, ENTRY_COUNT, Integer.MAX_VALUE);
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:4,代码来源:FaultyCacheStore.java



注:本文中的okhttp3.internal.io.FileSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PUSH类代码示例发布时间:2022-05-22
下一篇:
Java ListView类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap