Package java.io

Examples of java.io.DataOutputStream.writeChars()


        dos.writeInt(stringTotalLength);

            //write the data in the stringheap, if there is any
            if (stringTotalLength > 0) {
                if (cas.getStringHeap().charHeapPos > 0) {
                    dos.writeChars( String.valueOf(cas.getStringHeap().stringHeap, 0, cas.getStringHeap().charHeapPos) );
                }
                else {
                    // no stringheap data
                    //if there is data in the string lists, write a leading 0
                    if ( stringListLength > 0 ) {
View Full Code Here


                        //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

   
        constants.info( i++ + " Sending server response [" + i++ + "]..." + serverResp);
       
        try {
            out = connection.openDataOutputStream();
            out.writeChars(serverResp);
            out.flush();
            out.close();
        } catch ( Exception e) {
          constants.error( "Error writing to the bt output stream!");
          constants.error(e.getMessage());
View Full Code Here

      e1.printStackTrace();
    }
       
        try {
            out = connection.openDataOutputStream();
            out.writeChars(serverResp);
            out.flush();
            out.close();
        } catch ( Exception e) {
          constants.error( "Error writing to the bt output stream!");
          constants.error(e.getMessage());
View Full Code Here

    private static String eTagHash(Dataset dataSet, HttpServletRequest request)
            throws IOException, NoSuchAlgorithmException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        dos.writeLong(dataSet.published.getTime());
        dos.writeChars(request.getHeader("User-Agent"));
        dos.writeChars(request.getQueryString());
        return Base64.encodeBase64String(
                MessageDigest.getInstance("MD5").digest(bos.toByteArray()));
    }
   
View Full Code Here

            throws IOException, NoSuchAlgorithmException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        dos.writeLong(dataSet.published.getTime());
        dos.writeChars(request.getHeader("User-Agent"));
        dos.writeChars(request.getQueryString());
        return Base64.encodeBase64String(
                MessageDigest.getInstance("MD5").digest(bos.toByteArray()));
    }
   
    /**
 
View Full Code Here

      Path path = new Path("/foo/bar");
      // 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();
      System.out.println("Wrote file");

      // split it using a file input format
View Full Code Here

                        if (dirPath.equals(path)) {
                            skip(dis, mapLen);
                        } else {
                            oos.writeInt(pathLen);
                            oos.writeInt(mapLen);
                            oos.writeChars(path);
                            DiskMapTurboProvider.copyStreams(oos, dis, mapLen);
                        }
                    } else {
                        oos.writeInt(pathLen);
                        oos.writeInt(mapLen);
View Full Code Here

        temp.writeInt(set.size());
        for (Iterator i = set.iterator(); i.hasNext();) {
            File file = (File) i.next();
            StatusInfo info = (StatusInfo) map.get(file);
            temp.writeInt(file.getName().length());
            temp.writeChars(file.getName());
            temp.writeInt(info.getStatus() + (info.isDirectory() ? 65536 : 0));
        }
        temp.close();
        byte [] valueBytes = baos.toByteArray();
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.