Package java.io

Examples of java.io.RandomAccessFile.writeByte()


     * @tests java.io.RandomAccessFile#readByte()
     */
    public void test_readByte() throws IOException {
        // Test for method byte java.io.RandomAccessFile.readByte()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect bytes read/written", 127, raf.readByte());
        raf.close();
    }

View Full Code Here


     * @tests java.io.RandomAccessFile#readUnsignedByte()
     */
    public void test_readUnsignedByte() throws IOException {
        // Test for method int java.io.RandomAccessFile.readUnsignedByte()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(-1);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 255, raf.readUnsignedByte());
        raf.close();
    }

View Full Code Here

     * @tests java.io.RandomAccessFile#writeByte(int)
     */
    public void test_writeByteI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeByte(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 127, raf.readByte());
        raf.close();
    }

View Full Code Here

        while (true) {
            b = inStrm.read();
            if (b == -1) {
                break;
            }
            raf.writeByte(b);
        }
        inStrm.close();
        raf.close();
    }
View Full Code Here

        while (true) {
            b = inStrm.read();
            if (b == -1) {
                break;
            }
            raf.writeByte(b);
        }
        inStrm.close();
        raf.close();
    }
}
View Full Code Here

     * @tests java.io.RandomAccessFile#readUnsignedByte()
     */
    public void test_readUnsignedByte() throws IOException {
        // Test for method int java.io.RandomAccessFile.readUnsignedByte()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(-1);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 255, raf.readUnsignedByte());
        raf.close();
    }

View Full Code Here

     * @tests java.io.RandomAccessFile#writeByte(int)
     */
    public void test_writeByteI() throws IOException {
        // Test for method void java.io.RandomAccessFile.writeByte(int)
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect byte read/written", 127, raf.readByte());
        raf.close();
    }

View Full Code Here

     * @tests java.io.RandomAccessFile#readByte()
     */
    public void test_readByte() throws IOException {
        // Test for method byte java.io.RandomAccessFile.readByte()
        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "rw");
        raf.writeByte(127);
        raf.seek(0);
        assertEquals("Incorrect bytes read/written", 127, raf.readByte());
        raf.close();
    }

View Full Code Here

                RandomAccessFile aWriter = new RandomAccessFile(aFile, "rw");
                for (int i=0; i<m_aList.size();i++)
                {
                    String sLine = getItem(i);
                    aWriter.writeBytes(sLine);
                    aWriter.writeByte((int)'\n');
                }
                aWriter.close();
            }
           
            catch (java.io.FileNotFoundException fne)
View Full Code Here

                {
                    String sLine = getItem(i);
                    if (sLine.startsWith("["))
                    {
                        // write an extra empty line before next section.
                        aWriter.writeByte((int) '\n');
                    }
                    aWriter.writeBytes(sLine);
                    aWriter.writeByte((int) '\n');
                }
                aWriter.close();
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.