Package java.io

Examples of java.io.RandomAccessFile.writeBytes()


            raf.seek(raf.getFilePointer() - (fileName.length() + 1));

            String s = new String(fileName);
            s = s.replaceAll(".", PREFIX_CHAR);

            raf.writeBytes(s);

            if (log.isDebugEnabled())
            {
               log.debug("remove metadata : " + fileName);
               log.debug("remove changes log form fs : " + identifier);
View Full Code Here


               raf.seek(raf.getFilePointer() - (fName.length() + 1));

               String s = new String(fName);
               s = s.replaceAll(".", PREFIX_CHAR);

               raf.writeBytes(s);

               removeCounter++;

               if (log.isDebugEnabled())
               {
View Full Code Here

      // N.B.: This test actually tests to the JDK1.2 specification.  JDK1.1 says, in part:
      //   The line-terminating character(s), if any, are included as part of the string returned.
      // The actual behavior, and spec'd in 1.2, is to strip the line terminator.  Its presence is
      //   inferred from readLine's returning the correct string up to, but not including, the terminator.
      raf.seek(0);
      raf.writeBytes("foobar\n");
      raf.seek(0);
      harness.check(raf.readLine(), "foobar", "writeBytes(s)/readLine()");

      // writeChar(c)/writeChars(s)/readChar()
      raf.seek(0);
View Full Code Here

        switch (failTest) {
            case FailToLoad:
                index.delete();
                raf = new RandomAccessFile(index, "rw");
                raf.seek(index.length());
                raf.writeBytes("corrupt");
                break;
            case LoadInvalid:
                // page size 0
                raf.seek(0);
                raf.writeBytes("corrupt and cannot load metadata");
View Full Code Here

                raf.writeBytes("corrupt");
                break;
            case LoadInvalid:
                // page size 0
                raf.seek(0);
                raf.writeBytes("corrupt and cannot load metadata");
                break;
            case LoadCorrupt:
                // loadable but invalid metadata
                // location of order index low priority index for first destination...
                raf.seek(8*1024 + 57);
View Full Code Here

                              line.append(model.getValueAt(i, j)).append(' ');
                            }

                            line.append(eolStyle);

                            write.writeBytes(line.toString());
                          }

                          write.close();
                        }catch(Exception ee) {}
                      }
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

    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

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.