Examples of toByteArray()


Examples of org.apache.hadoop.mapred.proto.ShuffleHandlerRecoveryProtos.JobShuffleInfoProto.toByteArray()

          .setService(jobToken.getService().toString())
          .build();
      JobShuffleInfoProto proto = JobShuffleInfoProto.newBuilder()
          .setUser(user).setJobToken(tokenProto).build();
      try {
        stateDb.put(bytes(jobId.toString()), proto.toByteArray());
      } catch (DBException e) {
        throw new IOException("Error storing " + jobId, e);
      }
    }
    addJobToken(jobId, user, jobToken);
View Full Code Here

Examples of org.apache.hedwig.protocol.PubSubProtocol.Message.toByteArray()

        while (true) {
            try {
                message.getBody();
                stmt = conn.prepareStatement("INSERT INTO " + getTableNameForTopic(topic) + " VALUES(?,?)");
                stmt.setLong(1, seqId);
                stmt.setBlob(2, new SerialBlob(message.toByteArray()));

                int rowCount = stmt.executeUpdate();
                stmt.close();
                if (rowCount != 1) {
                    logger.error("Unexpected number of affected rows from derby");
View Full Code Here

Examples of org.apache.http.io.ByteArrayBuffer.toByteArray()

       
        ByteArrayBuffer buffer = new ByteArrayBuffer(8);
        buffer.append(b1, 0, b1.length);
        buffer.append(b2, 0, b2.length);
        
        assertEquals(s1 + s2, new String(buffer.toByteArray(), "US-ASCII"));
    }
   
    public void testAppendNullCharArray() throws Exception {
        ByteArrayBuffer buffer = new ByteArrayBuffer(8);
        buffer.append((char[])null, 0, 0);
View Full Code Here

Examples of org.apache.http.util.ByteArrayBuffer.toByteArray()

      while ((current = bis.read()) != -1) {
        baf.append((byte) current);
      }
     

      text = (new String(baf.toByteArray(), "utf-8")).trim();
    }
   
   
    content=text;
    JSONObject jsonObj = new JSONObject(text);
View Full Code Here

Examples of org.apache.james.core.MailHeaders.toByteArray()

        // if headers do not contains minimum REQUIRED headers fields throw Exception
        if (!headers.isValid()) {
            throw new MessagingException("Some REQURED header field is missing. Invalid Message");
        }
        ByteArrayInputStream headersIn = new ByteArrayInputStream(headers.toByteArray());
        sendMail(new MailImpl(getId(), sender, recipients, new SequenceInputStream(headersIn, msg)));
    }

    public void sendMail(Mail mail) throws MessagingException {
        MailImpl mailimpl = (MailImpl)mail;
View Full Code Here

Examples of org.apache.james.mime4j.util.ByteArrayBuffer.toByteArray()

       
        ByteArrayBuffer linebuf = new ByteArrayBuffer(8);
        for (int i = 0; i < teststrs.length; i++) {
            linebuf.clear();
            instream.readLine(linebuf);
            String s = new String(linebuf.toByteArray(), "US-ASCII");
            assertEquals(teststrs[i], s);
        }
        assertEquals(-1, instream.readLine(linebuf));
        assertEquals(-1, instream.readLine(linebuf));
    }
View Full Code Here

Examples of org.apache.james.mime4j.util.ByteSequence.toByteArray()

        assertEquals("raw", field.getName());
        assertEquals("  stuff;   more stuff;   a lot more stuff", field.getBody());
        ByteSequence raw = field.getRaw();
        assertNotNull(raw);
        assertEquals("raw:   stuff;\r\n   more stuff;\r\n   a lot more stuff",
                new String(raw.toByteArray(), "US-ASCII"));
    }

    public void testObsoleteSyntax() throws Exception {
        DefaultFieldBuilder builder = new DefaultFieldBuilder(0);
        builder.reset();
View Full Code Here

Examples of org.apache.james.protocols.imap.utils.FastByteArrayOutputStream.toByteArray()

              byte[] buf = new byte[ 0xFFFF ];
               
              for (int len; (len = in.read(buf)) != -1; )
                    out.write( buf, 0, len );
               
                final byte[] bytes = out.toByteArray();
                final ByteBuffer buffer = ByteBuffer.wrap(bytes);
                return decode(charset, buffer);
               
            } catch (IOException e) {
                throw new DecodingException(HumanReadableText.BAD_IO_ENCODING, "Bad character encoding", e);
View Full Code Here

Examples of org.apache.logging.log4j.core.Layout.toByteArray()

        final Layout layout = getLayout();
        if (layout == null) {
            events.add(event);
        } else if (layout instanceof SerializedLayout) {
            final byte[] header = layout.getHeader();
            final byte[] content = layout.toByteArray(event);
            final byte[] record = new byte[header.length + content.length];
            System.arraycopy(header, 0, record, 0, header.length);
            System.arraycopy(content, 0, record, header.length, content.length);
            data.add(record);
        } else {
View Full Code Here

Examples of org.apache.lucene.index.Payload.toByteArray()

        for (Long value: values) {
       
            LongPayload lPayload = new LongPayload(value);
            Payload payload = lPayload.asPayload();

            LongPayload bPayload = new LongPayload(payload.toByteArray());

            assertEquals(lPayload,bPayload);
            assertEquals(value,bPayload.asLong());
        }
    }
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.