gpt4 book ai didi

com.badlogic.gdx.backends.android.ZipResourceFile类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 15:33:31 26 4
gpt4 key购买 nike

本文整理了Java中com.badlogic.gdx.backends.android.ZipResourceFile类的一些代码示例,展示了ZipResourceFile类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipResourceFile类的具体详情如下:
包路径:com.badlogic.gdx.backends.android.ZipResourceFile
类名称:ZipResourceFile

ZipResourceFile介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

static public ZipResourceFile getResourceZipFile(String[] expansionFiles)
    throws IOException {
  ZipResourceFile apkExpansionFile = null;
  for (String expansionFilePath : expansionFiles) {
    if (null == apkExpansionFile) {
      apkExpansionFile = new ZipResourceFile(expansionFilePath);
    } else {
      apkExpansionFile.addPatchFile(expansionFilePath);
    }
  }
  return apkExpansionFile;
}

代码示例来源:origin: libgdx/libgdx

@Override
public AssetFileDescriptor getAssetFileDescriptor() throws IOException {
  return expansionFile.getAssetFileDescriptor(getPath());
}

代码示例来源:origin: libgdx/libgdx

@Override
public InputStream read() {
  InputStream input = null;
  try {
    input = expansionFile.getInputStream(getPath());
  } catch (IOException ex) {
    throw new GdxRuntimeException("Error reading file: " + file + " (ZipResourceFile)", ex);
  }
  return input;
}

代码示例来源:origin: stackoverflow.com

ZipResourceFile expansionFile = new ZipResourceFile("myZipFile.zip");
AssetFileDescriptor assetFileDescriptor = expansionFile.getAssetFileDescriptor("myMusic.mp3");
try {
  mediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor());
  mediaPlayer.prepare();
  mediaPlayer.start();
}
catch (IOException e) {
  // Handle exception
}

代码示例来源:origin: stackoverflow.com

ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(this,2001,2001);
if(expansionFile!=null){
    FileDescriptor fd = expansionFile.getAssetFileDescriptor("audio_01.mp3");
    //or
    InputStream is = expansionFile.getInputStream("audio_01.mp3");
}

代码示例来源:origin: stackoverflow.com

byte[] buf = new byte[1024 * 256];
try {
  zrf = new ZipResourceFile(fileName);
  ZipEntryRO[] entries = zrf.getAllEntries();
      try {
        dis = new DataInputStream(
            zrf.getInputStream(entry.mFileName));

代码示例来源:origin: stackoverflow.com

ZipResourceFile zip = new ZipResourceFile(strMainPath);
InputStream iStream = zip.getInputStream("img1.jpg");

代码示例来源:origin: libgdx/libgdx

@Override
  public boolean exists() {
    return hasAssetFd || expansionFile.getEntriesAt(getPath()).length != 0;
  }
}

代码示例来源:origin: stackoverflow.com

private static void setMediaPlayerDataSourceFromZip(MediaPlayer mediaPlayer,
    String zipFileName, String fileNameInZip) throws IOException,
    FileNotFoundException {
  ZipResourceFile zip = new ZipResourceFile(zipFileName);
  FileInputStream fis = new FileInputStream(zipFileName);
  try {
    FileDescriptor zipfd = fis.getFD();

    ZipEntryRO entry = zipFindFile(zip, fileNameInZip);
    mediaPlayer.setDataSource(zipfd, entry.mOffset,
        entry.mUncompressedLength);
  } finally {
    fis.close();
  }
}

private static ZipEntryRO zipFindFile(ZipResourceFile zip, String fileNameInZip) {
  for (ZipEntryRO entry : zip.getAllEntries()) {
    if (entry.mFileName.equals(fileNameInZip))
      return entry;
  }
  throw new RuntimeException(String.format("File \"%s\"not found in zip", fileNameInZip));
}

代码示例来源:origin: libgdx/libgdx

static private int read4LE(RandomAccessFile f) throws EOFException,
    IOException {
  return swapEndian(f.readInt());
}

代码示例来源:origin: libgdx/libgdx

public ZipResourceFile(String zipFileName) throws IOException {
  addPatchFile(zipFileName);
}

代码示例来源:origin: libgdx/libgdx

int header = read4LE(f);
if (header == kEOCDSignature) {
  Log.i(LOG_TAG, "Found Zip archive, but it looks empty");

代码示例来源:origin: stackoverflow.com

ZipResourceFile expansionFile = new ZipResourceFile("myZipFile.zip");
AssetFileDescriptor assetFileDescriptor = expansionFile.getAssetFileDescriptor("myMusic.mp3");
try {
  mediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor(),
               assetFileDescriptor.getStartOffset(),
               assetFileDescriptor.getLength());
  mediaPlayer.prepare();
  mediaPlayer.start();
}
catch (IOException e) {
  // Handle exception
}

代码示例来源:origin: libgdx/libgdx

@Override
  public boolean exists() {
    return hasAssetFd || expansionFile.getEntriesAt(getPath()).length != 0;
  }
}

代码示例来源:origin: stackoverflow.com

for (String expansionFilePath : expansionFiles) {
  if ( null == apkExpansionFile ) {
    apkExpansionFile = new ZipResourceFile(expansionFilePath);
  } else {
    apkExpansionFile.addPatchFile(expansionFilePath);

代码示例来源:origin: libgdx/libgdx

static private int read4LE(RandomAccessFile f) throws EOFException,
    IOException {
  return swapEndian(f.readInt());
}

代码示例来源:origin: libgdx/libgdx

public ZipResourceFile(String zipFileName) throws IOException {
  addPatchFile(zipFileName);
}

代码示例来源:origin: libgdx/libgdx

int header = read4LE(f);
if (header == kEOCDSignature) {
  Log.i(LOG_TAG, "Found Zip archive, but it looks empty");

代码示例来源:origin: libgdx/libgdx

@Override
public AssetFileDescriptor getAssetFileDescriptor() throws IOException {
  return expansionFile.getAssetFileDescriptor(getPath());
}

代码示例来源:origin: libgdx/libgdx

@Override
public InputStream read() {
  InputStream input = null;
  try {
    input = expansionFile.getInputStream(getPath());
  } catch (IOException ex) {
    throw new GdxRuntimeException("Error reading file: " + file + " (ZipResourceFile)", ex);
  }
  return input;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com