Search in sources :

Example 81 with BufferedWriter

use of java.io.BufferedWriter in project android_frameworks_base by ParanoidAndroid.

the class MediaPlayerPerformance method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    //Insert a 2 second before launching the test activity. This is
    //the workaround for the race condition of requesting the updated surface.
    Thread.sleep(2000);
    getActivity();
    if (MediaFrameworkPerfTestRunner.mGetNativeHeapDump)
        MediaTestUtil.getNativeHeapDump(this.getName() + "_before");
    if (MediaFrameworkPerfTestRunner.mGetProcmem) {
        mProcMemWriter = new BufferedWriter(new FileWriter(new File(MEDIA_PROCMEM_OUTPUT), true));
        mProcMemWriter.write(this.getName() + "\n");
    }
    mMemWriter = new BufferedWriter(new FileWriter(new File(MEDIA_MEMORY_OUTPUT), true));
    mMemWriter.write(this.getName() + "\n");
}
Also used : FileWriter(java.io.FileWriter) File(java.io.File) BufferedWriter(java.io.BufferedWriter)

Example 82 with BufferedWriter

use of java.io.BufferedWriter in project android_frameworks_base by ParanoidAndroid.

the class MediaRecorderStressTest method setUp.

protected void setUp() throws Exception {
    final Semaphore sem = new Semaphore(0);
    mLooperThread = new Thread() {

        @Override
        public void run() {
            Log.v(TAG, "starting looper");
            Looper.prepare();
            mHandler = new Handler();
            sem.release();
            Looper.loop();
            Log.v(TAG, "quit looper");
        }
    };
    mLooperThread.start();
    if (!sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
        fail("Failed to start the looper.");
    }
    //Insert a 2 second before launching the test activity. This is
    //the workaround for the race condition of requesting the updated surface.
    Thread.sleep(2000);
    getActivity();
    super.setUp();
    File stressOutFile = new File(String.format("%s/%s", Environment.getExternalStorageDirectory(), MEDIA_STRESS_OUTPUT));
    mOutput = new BufferedWriter(new FileWriter(stressOutFile, true));
    mOutput.write(this.getName() + "\n");
}
Also used : FileWriter(java.io.FileWriter) Handler(android.os.Handler) Semaphore(java.util.concurrent.Semaphore) File(java.io.File) BufferedWriter(java.io.BufferedWriter)

Example 83 with BufferedWriter

use of java.io.BufferedWriter in project android_frameworks_base by ParanoidAndroid.

the class CameraStressTest method setUp.

protected void setUp() throws Exception {
    final Semaphore sem = new Semaphore(0);
    mLooperThread = new Thread() {

        @Override
        public void run() {
            Log.v(TAG, "starting looper");
            Looper.prepare();
            mHandler = new Handler();
            sem.release();
            Looper.loop();
            Log.v(TAG, "quit looper");
        }
    };
    mLooperThread.start();
    if (!sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
        fail("Failed to start the looper.");
    }
    getActivity();
    super.setUp();
    mCameraTestHelper = new CameraTestHelper();
    File stressOutFile = new File(String.format("%s/%s", Environment.getExternalStorageDirectory(), CAMERA_STRESS_OUTPUT));
    mOutput = new BufferedWriter(new FileWriter(stressOutFile, true));
    mOutput.write(this.getName() + "\n");
}
Also used : CameraTestHelper(com.android.mediaframeworktest.CameraTestHelper) FileWriter(java.io.FileWriter) Handler(android.os.Handler) Semaphore(java.util.concurrent.Semaphore) File(java.io.File) BufferedWriter(java.io.BufferedWriter)

Example 84 with BufferedWriter

use of java.io.BufferedWriter in project android_frameworks_base by ParanoidAndroid.

the class VideoEditorStressTest method writeTestCaseHeader.

private void writeTestCaseHeader(String testCaseName) throws Exception {
    File outFile = new File(VIDEOEDITOR_OUTPUT);
    Writer output = new BufferedWriter(new FileWriter(outFile, true));
    output.write("\n\n" + testCaseName + "\n");
    output.close();
}
Also used : FileWriter(java.io.FileWriter) File(java.io.File) BufferedWriter(java.io.BufferedWriter) FileWriter(java.io.FileWriter) Writer(java.io.Writer) BufferedWriter(java.io.BufferedWriter)

Example 85 with BufferedWriter

use of java.io.BufferedWriter in project generator by mybatis.

the class MyBatisGenerator method writeFile.

/**
     * Writes, or overwrites, the contents of the specified file.
     *
     * @param file
     *            the file
     * @param content
     *            the content
     * @param fileEncoding
     *            the file encoding
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
private void writeFile(File file, String content, String fileEncoding) throws IOException {
    FileOutputStream fos = new FileOutputStream(file, false);
    OutputStreamWriter osw;
    if (fileEncoding == null) {
        osw = new OutputStreamWriter(fos);
    } else {
        osw = new OutputStreamWriter(fos, fileEncoding);
    }
    BufferedWriter bw = new BufferedWriter(osw);
    bw.write(content);
    bw.close();
}
Also used : FileOutputStream(java.io.FileOutputStream) OutputStreamWriter(java.io.OutputStreamWriter) BufferedWriter(java.io.BufferedWriter)

Aggregations

BufferedWriter (java.io.BufferedWriter)4214 FileWriter (java.io.FileWriter)2181 File (java.io.File)1879 IOException (java.io.IOException)1847 OutputStreamWriter (java.io.OutputStreamWriter)1344 BufferedReader (java.io.BufferedReader)747 FileOutputStream (java.io.FileOutputStream)656 ArrayList (java.util.ArrayList)386 FileReader (java.io.FileReader)376 InputStreamReader (java.io.InputStreamReader)349 PrintWriter (java.io.PrintWriter)324 Writer (java.io.Writer)324 Test (org.junit.Test)286 FileNotFoundException (java.io.FileNotFoundException)217 OutputStream (java.io.OutputStream)213 HashMap (java.util.HashMap)200 Path (java.nio.file.Path)177 InputStream (java.io.InputStream)171 FileInputStream (java.io.FileInputStream)158 StringWriter (java.io.StringWriter)143