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

Java FileAttribute类代码示例

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

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



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

示例1: writeAttribute

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
@NotNull
public static DataOutputStream writeAttribute(final int fileId, @NotNull FileAttribute att) {
  DataOutputStream stream = new AttributeOutputStream(fileId, att);
  if (att.isVersioned()) {
    try {
      DataInputOutputUtil.writeINT(stream, att.getVersion());
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  return stream;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:FSRecords.java


示例2: writeAttribute

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
@Nonnull
public static DataOutputStream writeAttribute(final int fileId, @Nonnull FileAttribute att) {
  DataOutputStream stream = new AttributeOutputStream(fileId, att);
  if (att.isVersioned()) {
    try {
      DataInputOutputUtil.writeINT(stream, att.getVersion());
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  return stream;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:FSRecords.java


示例3: readAttribute

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
@Nullable
private static DataInputStream readAttribute(int fileId, FileAttribute attribute) throws IOException {
  checkFileIsValid(fileId);

  int recordId = getAttributeRecordId(fileId);
  if (recordId == 0) return null;
  int encodedAttrId = DbConnection.getAttributeId(attribute.getId());

  Storage storage = getAttributesStorage();

  DataInputStream attrRefs = storage.readStream(recordId);
  int page = 0;

  try {
    if (bulkAttrReadSupport) skipRecordHeader(attrRefs, DbConnection.RESERVED_ATTR_ID, fileId);

    while (attrRefs.available() > 0) {
      final int attIdOnPage = DataInputOutputUtil.readINT(attrRefs);
      final int attrAddressOrSize = DataInputOutputUtil.readINT(attrRefs);

      if (attIdOnPage != encodedAttrId) {
        if (inlineAttributes && attrAddressOrSize < MAX_SMALL_ATTR_SIZE) {
          attrRefs.skipBytes(attrAddressOrSize);
        }
      } else {
        if (inlineAttributes && attrAddressOrSize < MAX_SMALL_ATTR_SIZE) {
          byte[] b = new byte[attrAddressOrSize];
          attrRefs.readFully(b);
          return new DataInputStream(new ByteArrayInputStream(b));
        }
        page = inlineAttributes ? attrAddressOrSize - MAX_SMALL_ATTR_SIZE : attrAddressOrSize;
        break;
      }
    }
  }
  finally {
    attrRefs.close();
  }

  if (page == 0) {
    return null;
  }
  DataInputStream stream = getAttributesStorage().readStream(page);
  if (bulkAttrReadSupport) skipRecordHeader(stream, encodedAttrId, fileId);
  return stream;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:FSRecords.java


示例4: findAttributePage

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
private static int findAttributePage(int fileId, FileAttribute attr, boolean toWrite) throws IOException {
  checkFileIsValid(fileId);

  int recordId = getAttributeRecordId(fileId);
  int encodedAttrId = DbConnection.getAttributeId(attr.getId());
  boolean directoryRecord = false;

  Storage storage = getAttributesStorage();

  if (recordId == 0) {
    if (!toWrite) return 0;

    recordId = storage.createNewRecord();
    setAttributeRecordId(fileId, recordId);
    directoryRecord = true;
  }
  else {
    DataInputStream attrRefs = storage.readStream(recordId);

    try {
      if (bulkAttrReadSupport) skipRecordHeader(attrRefs, DbConnection.RESERVED_ATTR_ID, fileId);

      while (attrRefs.available() > 0) {
        final int attIdOnPage = DataInputOutputUtil.readINT(attrRefs);
        final int attrAddressOrSize = DataInputOutputUtil.readINT(attrRefs);

        if (attIdOnPage == encodedAttrId) {
          if (inlineAttributes) {
            return attrAddressOrSize < MAX_SMALL_ATTR_SIZE ? -recordId : attrAddressOrSize - MAX_SMALL_ATTR_SIZE;
          } else {
            return attrAddressOrSize;
          }
        } else {
          if (inlineAttributes && attrAddressOrSize < MAX_SMALL_ATTR_SIZE) {
            attrRefs.skipBytes(attrAddressOrSize);
          }
        }

      }
    }
    finally {
      attrRefs.close();
    }
  }

  if (toWrite) {
    Storage.AppenderStream appender = storage.appendStream(recordId);
    if (bulkAttrReadSupport) {
      if (directoryRecord) {
        DataInputOutputUtil.writeINT(appender, DbConnection.RESERVED_ATTR_ID);
        DataInputOutputUtil.writeINT(appender, fileId);
      }
    }

    DataInputOutputUtil.writeINT(appender, encodedAttrId);
    int attrAddress = storage.createNewRecord();
    DataInputOutputUtil.writeINT(appender, inlineAttributes ? attrAddress + MAX_SMALL_ATTR_SIZE : attrAddress);
    DbConnection.REASONABLY_SMALL.myAttrPageRequested = true;
    try {
      appender.close();
    } finally {
      DbConnection.REASONABLY_SMALL.myAttrPageRequested = false;
    }
    return attrAddress;
  }

  return 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:69,代码来源:FSRecords.java


示例5: AttributeOutputStream

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
private AttributeOutputStream(final int fileId, @NotNull FileAttribute attribute) {
  super(new BufferExposingByteArrayOutputStream());
  myFileId = fileId;
  myAttribute = attribute;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FSRecords.java


示例6: readAttribute

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
@Nullable
@Override
public DataInputStream readAttribute(@Nonnull VirtualFile file, @Nonnull FileAttribute att) {
  return new DataInputStream(new ByteArrayInputStream(new byte[100]));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:CompilerServerManagingFSImpl.java


示例7: writeAttribute

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
@Nonnull
@Override
public DataOutputStream writeAttribute(@Nonnull VirtualFile file, @Nonnull FileAttribute att) {
  return new DataOutputStream(new ByteArrayOutputStream(100));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:CompilerServerManagingFSImpl.java


示例8: AttributeOutputStream

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
private AttributeOutputStream(final int fileId, @Nonnull FileAttribute attribute) {
  super(new BufferExposingByteArrayOutputStream());
  myFileId = fileId;
  myAttribute = attribute;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:FSRecords.java


示例9: create

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
@Nullable
@Override
protected FileAttribute create(Pair<String, Integer> key) {
  return new FileAttribute(key.first, key.second, false);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:VirtualFileGistImpl.java


示例10: getFileAttribute

import com.intellij.openapi.vfs.newvfs.FileAttribute; //导入依赖的package包/类
private FileAttribute getFileAttribute(Project project) {
  synchronized (ourAttributes) {
    return ourAttributes.get(Pair.create(myId + project.getLocationHash(), myVersion + ourInternalVersion));
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:VirtualFileGistImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java GlobFilenameFilter类代码示例发布时间:2022-05-22
下一篇:
Java BucketCache类代码示例发布时间: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