Android Open Source - ScalAR I O






From Project

Back to project page ScalAR.

License

The source code is released under:

GNU General Public License

If you think the Android project ScalAR listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package edu.dhbw.andar.util;
/*  www  .  j a v  a2  s  . co  m*/
import android.content.res.AssetManager;
import android.content.res.Resources;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class IO {
  
  /**
   * transfers required files to the the private file system part
   * in order to be access them from C Code.
   * required, as you can not access the files of the apk package directly
   */
  public static void transferFilesToPrivateFS(File base, Resources res) throws IOException {
    AssetManager am = res.getAssets();
    if (!base.exists()) {
      base.mkdir();
    }
    if (base.exists()) {
      File cameraFile = new File(base, "camera_para.dat");
      if (!cameraFile.exists()) {
        copy(am.open("camera_para.dat"), new FileOutputStream(cameraFile));
      }
    }
  }
  /**
   * 
   * @param base
   * @param assetFileName filename of the file in the assets folder
   * @param res
   * @throws IOException
   */
  public static void transferFileToPrivateFS(File base, String assetFileName,Resources res) throws IOException {
    AssetManager am = res.getAssets();
    if (!base.exists()) {
      base.mkdir();
    }
    if (base.exists()) {
      File file = new File(base, assetFileName);
      if (!file.exists()) {
        copy(am.open(assetFileName), new FileOutputStream(file));
      }
    }
  }
  
  
  
  static void copy( InputStream in, OutputStream out ) throws IOException 
    { 
      byte[] buffer = new byte[ 0xFFFF ]; 
      for ( int len; (len = in.read(buffer)) != -1; ) 
        out.write( buffer, 0, len ); 
    }
}




Java Source Code List

com.skylion.speech.GoogleTranslate.java
com.skylion.speech.Narrator.java
com.skylion.speech.Synthesiser.java
edu.dhbw.andar.ARObject.java
edu.dhbw.andar.ARToolkit.java
edu.dhbw.andar.AndARActivity.java
edu.dhbw.andar.AndARRenderer.java
edu.dhbw.andar.CameraHolder.java
edu.dhbw.andar.CameraParameters.java
edu.dhbw.andar.CameraPreviewHandler.java
edu.dhbw.andar.CameraStatus.java
edu.dhbw.andar.Config.java
edu.dhbw.andar.GenericFunctions.java
edu.dhbw.andar.exceptions.AndARException.java
edu.dhbw.andar.exceptions.AndARRuntimeException.java
edu.dhbw.andar.interfaces.MarkerVisibilityListener.java
edu.dhbw.andar.interfaces.OpenGLRenderer.java
edu.dhbw.andar.interfaces.PreviewFrameSink.java
edu.dhbw.andar.pub.CustomActivity.java
edu.dhbw.andar.pub.CustomObject.java
edu.dhbw.andar.pub.CustomRenderer.java
edu.dhbw.andar.pub.SimpleBox.java
edu.dhbw.andar.util.GraphicsUtil.java
edu.dhbw.andar.util.IO.java
edu.dhbw.andobjviewer.AugmentedModelViewerActivity.java
edu.dhbw.andobjviewer.CheckFileManagerActivity.java
edu.dhbw.andobjviewer.Config.java
edu.dhbw.andobjviewer.InstructionsActivity.java
edu.dhbw.andobjviewer.ModelChooser.java
edu.dhbw.andobjviewer.graphics.LightingRenderer.java
edu.dhbw.andobjviewer.graphics.Model3D.java
edu.dhbw.andobjviewer.graphics.Renderer.java
edu.dhbw.andobjviewer.models.Group.java
edu.dhbw.andobjviewer.models.Material.java
edu.dhbw.andobjviewer.models.Model.java
edu.dhbw.andobjviewer.models.Vector3D.java
edu.dhbw.andobjviewer.parser.MtlParser.java
edu.dhbw.andobjviewer.parser.ObjParser.java
edu.dhbw.andobjviewer.parser.ParseException.java
edu.dhbw.andobjviewer.parser.SimpleTokenizer.java
edu.dhbw.andobjviewer.parser.Util.java
edu.dhbw.andobjviewer.util.ArrayIterator.java
edu.dhbw.andobjviewer.util.AssetsFileUtil.java
edu.dhbw.andobjviewer.util.BaseFileUtil.java
edu.dhbw.andobjviewer.util.FixedPointUtils.java
edu.dhbw.andobjviewer.util.MatrixUtils.java
edu.dhbw.andobjviewer.util.MemUtil.java
edu.dhbw.andobjviewer.util.SDCardFileUtil.java