Package java.io

Examples of java.io.RandomAccessFile.writeBytes()


     */
    public void test_readFully$B() throws IOException {
        // Test for method void java.io.RandomAccessFile.readFully(byte [])
        byte[] buf = new byte[10];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.readFully(buf);
        assertEquals("Incorrect bytes read/written", "HelloWorld", new String(
                buf, 0, 10, "UTF-8"));
        raf.close();
View Full Code Here


    public void test_readFully$BII() throws IOException {
        // Test for method void java.io.RandomAccessFile.readFully(byte [], int,
        // int)
        byte[] buf = new byte[10];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.readFully(buf, 0, buf.length);
        assertEquals("Incorrect bytes read/written", "HelloWorld", new String(
                buf, 0, 10, "UTF-8"));
        try {
View Full Code Here

     */
    public void test_skipBytesI() throws IOException {
        // Test for method int java.io.RandomAccessFile.skipBytes(int)
        byte[] buf = new byte[5];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.skipBytes(5);
        raf.readFully(buf);
        assertEquals("Failed to skip bytes", "World", new String(buf, 0, 5, "UTF-8"));
        raf.close();
View Full Code Here

    public void test_writeBytesLjava_lang_String() throws IOException {
        // Test for method void
        // java.io.RandomAccessFile.writeBytes(java.lang.String)
        byte[] buf = new byte[10];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.readFully(buf);
        assertEquals("Incorrect bytes read/written", "HelloWorld", new String(
                buf, 0, 10, "UTF-8"));
        raf.close();
View Full Code Here

    public void test_writeBytesLjava_lang_String() throws IOException {
        // Test for method void
        // java.io.RandomAccessFile.writeBytes(java.lang.String)
        byte[] buf = new byte[10];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.readFully(buf);
        assertEquals("Incorrect bytes read/written", "HelloWorld", new String(
                buf, 0, 10));
        raf.close();
View Full Code Here

     */
    public void test_readFully$B() throws IOException {
        // Test for method void java.io.RandomAccessFile.readFully(byte [])
        byte[] buf = new byte[10];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.readFully(buf);
        assertEquals("Incorrect bytes read/written", "HelloWorld", new String(
                buf, 0, 10));
        raf.close();
View Full Code Here

    public void test_readFully$BII() throws IOException {
        // Test for method void java.io.RandomAccessFile.readFully(byte [], int,
        // int)
        byte[] buf = new byte[10];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.readFully(buf, 0, buf.length);
        assertEquals("Incorrect bytes read/written", "HelloWorld", new String(
                buf, 0, 10));
        try {
View Full Code Here

     */
    public void test_skipBytesI() throws IOException {
        // Test for method int java.io.RandomAccessFile.skipBytes(int)
        byte[] buf = new byte[5];
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeBytes("HelloWorld");
        raf.seek(0);
        raf.skipBytes(5);
        raf.readFully(buf);
        assertEquals("Failed to skip bytes", "World", new String(buf, 0, 5));
        raf.close();
View Full Code Here

        final Date date = new Date();
        final File logFile = new File(dir, baseFileName + FORMAT.format(date) + "." + fileExtension);

        final RandomAccessFile index = new RandomAccessFile(indexFile, "rw");
        index.seek(index.length());
        index.writeBytes(logFile.getName() + ": " + message + "\n");
        index.close();

        os = new PrintStream(new FileOutputStream(logFile));
    }
View Full Code Here

      //start before close of root element
      long pos = contentString.lastIndexOf("</portal>");
      ras.seek(pos);

      //start page fragment
      ras.writeBytes("    <fragment name=\"" + name + "\" type=\"page\" >" + PlutoAdminConstants.LS);
      ras.writeBytes("        <navigation>" + PlutoAdminConstants.LS);
      ras.writeBytes("          <title>" + page.getTitle());
      ras.writeBytes("</title>" + PlutoAdminConstants.LS);
      ras.writeBytes("          <description>" + page.getDescription());
      ras.writeBytes("</description>" + PlutoAdminConstants.LS);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.