Package java.io

Examples of java.io.DataOutputStream.writeChars()


            // this is a string in the string list
            if (ref != 0) {
              // update the ref
              refheap[i + StringHeap.CHAR_HEAP_POINTER_OFFSET] = pos;
              // write out the chars in the string
              dos.writeChars((String) cas.getStringHeap().stringList.get(ref));
              dos.writeChar(0); // null terminate each string
              // update pos
              pos += 1 + ((String) cas.getStringHeap().stringList.get(ref)).length();
            }
          }
View Full Code Here


  throws IOException {
    // create a multi-block file on hdfs
    DataOutputStream out = fs.create(new Path(inDir, fileName), true, 4096,
                                     (short) 2, 512, null);
    for(int i=0; i < 1000; ++i) {
      out.writeChars("Hello\n");
    }
    out.close();
    System.out.println("Wrote file");
  }
View Full Code Here

        }

        // Write out the stripped rules (rules with extra spaces removed
        //   These go last in the data area, even though they are not last in the header.
        Assert.assrt(outputPos == header[14]);
        dos.writeChars(strippedRules);
        outputPos += strippedRules.length() * 2;
        while (outputPos % 8 != 0) { // pad to an 8 byte boundary
            dos.write(0);
            outputPos += 1;
        }
View Full Code Here

    Path path = new Path(inDir, fileName);
    final short replication = 2;
    DataOutputStream out = fs.create(path, true, 4096,
                                     replication, 512, null);
    for(int i=0; i < 1000; ++i) {
      out.writeChars("Hello\n");
    }
    out.close();
    System.out.println("Wrote file");
    DFSTestUtil.waitReplication(fs, path, replication);
  }
View Full Code Here

                CharArrayReader stream = new CharArrayReader((char[]) document);
                char[] buf = new char[1024 * 8];
                int count = 0;

                while ((count = stream.read(buf, 0, buf.length)) != -1) {
                    bw.writeChars(new String(buf, 0, count));
                }
                stream.close();
            } else if (document instanceof String) {
                bw.writeChars((String) document);
            } else if (document instanceof Reader) {
View Full Code Here

                while ((count = stream.read(buf, 0, buf.length)) != -1) {
                    bw.writeChars(new String(buf, 0, count));
                }
                stream.close();
            } else if (document instanceof String) {
                bw.writeChars((String) document);
            } else if (document instanceof Reader) {
                char[] buf = new char[1024 * 8];
                int count = 0;

                while ((count = ((Reader) document).read(buf, 0, buf.length)) != -1) {
View Full Code Here

            } else if (document instanceof Reader) {
                char[] buf = new char[1024 * 8];
                int count = 0;

                while ((count = ((Reader) document).read(buf, 0, buf.length)) != -1) {
                    bw.writeChars(new String(buf, 0, count));
                }
                ((Reader) document).close();
            }
        }

View Full Code Here

    Path path = new Path(location);

    // create a multi-block file on hdfs
    DataOutputStream out = fs.create(path, true, 4096, (short) 2, 512, null);
    for (int i = 0; i < 1000; ++i) {
      out.writeChars("Hello\n");
    }
    out.close();

    return path;
  }
View Full Code Here

                CharArrayReader stream = new CharArrayReader((char[]) document);
                char[] buf = new char[1024 * 8];
                int count = 0;

                while ((count = stream.read(buf, 0, buf.length)) != -1) {
                    bw.writeChars(new String(buf, 0, count));
                }
                stream.close();
            } else if (document instanceof String) {
                bw.writeChars((String) document);
            } else if (document instanceof Reader) {
View Full Code Here

                while ((count = stream.read(buf, 0, buf.length)) != -1) {
                    bw.writeChars(new String(buf, 0, count));
                }
                stream.close();
            } else if (document instanceof String) {
                bw.writeChars((String) document);
            } else if (document instanceof Reader) {
                char[] buf = new char[1024 * 8];
                int count = 0;

                while ((count = ((Reader) document).read(buf, 0, buf.length)) != -1) {
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.