Examples of toByteArray()

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

      JobShuffleInfoProto proto = JobShuffleInfoProto.newBuilder()
      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 {
                stmt = conn.prepareStatement("INSERT INTO " + getTableNameForTopic(topic) + " VALUES(?,?)");
                stmt.setLong(1, seqId);
                stmt.setBlob(2, new SerialBlob(message.toByteArray()));

                int rowCount = stmt.executeUpdate();
                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();
    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++) {
            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();
        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);
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) {
        } 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);
        } 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());

View Full Code Here
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.