Examples of ByteArrayDataSource


Examples of org.efs.openreports.util.ByteArrayDataSource

   
    public void deliverReport(ReportSchedule reportSchedule, ReportEngineOutput reportOutput) throws DeliveryException
    {
        ArrayList<ByteArrayDataSource> htmlImageDataSources = new ArrayList<ByteArrayDataSource>();
       
        ByteArrayDataSource byteArrayDataSource = exportReport(reportOutput, reportSchedule, htmlImageDataSources);

        MailMessage mail = new MailMessage();              
        mail.setByteArrayDataSource(byteArrayDataSource);
        mail.addHtmlImageDataSources(htmlImageDataSources);         
        mail.setSender(reportSchedule.getUser().getEmail());
        mail.parseRecipients(reportSchedule.getRecipients());
        mail.setBounceAddress(reportSchedule.getDeliveryReturnAddress());
       
        if (reportSchedule.getScheduleDescription() != null && reportSchedule.getScheduleDescription().trim().length() > 0)
        {
            mail.setSubject(reportSchedule.getScheduleDescription());
        }
        else
        {
            mail.setSubject(reportSchedule.getReport().getName());
        }
       
        if (reportSchedule.getExportType() != ExportType.HTML.getCode())
        {
            mail.setText(reportSchedule.getReport().getName() + ": Generated on " + new Date());
        }

        try
        {
            mailProvider.sendMail(mail);
        }
        catch(ProviderException pe)
        {
            throw new DeliveryException(pe);
        }
       
        log.debug(byteArrayDataSource.getName() + " sent to: " + mail.formatRecipients(";"));       
    }
View Full Code Here

Examples of org.mule.message.ds.ByteArrayDataSource

                dh = new DataHandler(new StringDataSource((String) object, name));
            }
        }
        else if (object instanceof byte[] && contentType != null)
        {
            dh = new DataHandler(new ByteArrayDataSource((byte[]) object, contentType, name));
        }
        else
        {
            dh = new DataHandler(object, contentType);
        }
View Full Code Here

Examples of org.openmeetings.utils.mail.ByteArrayDataSource

    mimeMessage.addRecipients(Message.RecipientType.TO,
        InternetAddress.parse(recipients, false));

    // -- Create a new message --
    BodyPart msg = new MimeBodyPart();
    msg.setDataHandler(new DataHandler(new ByteArrayDataSource(htmlBody,
        "text/html; charset=\"utf-8\"")));

    Multipart multipart = new MimeMultipart();

    BodyPart iCalAttachment = new MimeBodyPart();
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataSerializer.ByteArrayDataSource

    new ExecHelper(new OutputParser.Stub(), repoLoc).run("hg", "commit", "--addremove", "-m", "FIRST");
    //
    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), 0);
    HgDataFile df = hgRepo.getFileNode("file1");
    cf.add(df, new ByteArrayDataSource("hello\nworld".getBytes()));
    Transaction tr = newTransaction(hgRepo);
    Nodeid secondRev = cf.commit("SECOND", tr);
    tr.commit();
    //
    List<HgChangeset> commits = new HgLogCommand(hgRepo).execute();
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataSerializer.ByteArrayDataSource

    HgRepository hgRepo = new HgLookup().detect(repoLoc);
    assertEquals("[sanity]", 0, new HgLogCommand(hgRepo).execute().size());
    CommitFacility cf = new CommitFacility(Internals.getInstance(hgRepo), NO_REVISION);
    HgDataFile df = hgRepo.getFileNode(fname);
    final byte[] initialContent = "hello\nworld".getBytes();
    cf.add(df, new ByteArrayDataSource(initialContent));
    String comment = "commit 1";
    Transaction tr = newTransaction(hgRepo);
    Nodeid c1Rev = cf.commit(comment,  tr);
    tr.commit();
    List<HgChangeset> commits = new HgLogCommand(hgRepo).execute();
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataSerializer.ByteArrayDataSource

          assert patchBaseRev != NO_REVISION;
          ReadContentInspector insp = new ReadContentInspector().read(revlogStream, patchBaseRev);
          complete = p.apply(new ByteArrayDataAccess(insp.content), -1);
          baseRev = lastEntryIndex + 1;
        }
        ds = new ByteArrayDataSource(complete);
        revLen = complete.length;
      } catch (IOException ex) {
        // unlikely to happen, as ByteArrayDataSource throws IOException only in case of programming errors
        // hence, throwing rt exception here makes more sense here than HgIOException (even that latter is in throws)
        throw new HgInvalidDataFormatException("Failed to reconstruct revision", ex);
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataSerializer.ByteArrayDataSource

    }
    //
    Patch patch = GeneratePatchInspector.delta(lastFullContent.second(), contentByteArray);
    int patchSerializedLength = patch.serializedLength();
    final boolean writeComplete = preferCompleteOverPatch(patchSerializedLength, contentByteArray.length);
    DataSerializer.DataSource dataSource = writeComplete ? new ByteArrayDataSource(contentByteArray) : patch.new PatchDataSource();
    //
    doAdd(newRev, p1, p2, linkRevision, writeComplete ? lastEntryIndex+1 : lastEntryBase, contentByteArray.length, dataSource);
    lastFullContent = new Pair<Integer, byte[]>(lastEntryIndex, contentByteArray);
    return new Pair<Integer, Nodeid>(lastEntryIndex, lastEntryRevision);
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataSerializer.ByteArrayDataSource

        if (writeComplete) {
          revlogHeader.baseRevision(revisionSequence.size());
        }
        assert revlogHeader.baseRevision() >= 0;

        DataSerializer.DataSource dataSource = writeComplete ? new ByteArrayDataSource(content) : patch.new PatchDataSource();
        revlogDataZip.reset(dataSource);
        final int compressedLen;
        final boolean useUncompressedData = preferCompressedOverComplete(revlogDataZip.getCompressedLength(), dataSource.serializeLength());
        if (useUncompressedData) {
          // compression wasn't too effective,
View Full Code Here

Examples of uk.ac.starlink.util.ByteArrayDataSource

                BufferedDataOutputStream bos = new BufferedDataOutputStream(os);
                tmpFits.write(bos);
                bos.flush();
                // Restore the name that was removed above
                votMetaHdu.getHeader().addValue("EXTNAME", votMetaName, "Table metadata in VOTable format");
                ByteArrayDataSource dataSrc = new ByteArrayDataSource(filename, os.toByteArray());
                bos.close();
                StarTable starTable = new FitsPlusTableBuilder().makeStarTable(dataSrc, true,
                        StoragePolicy.getDefaultPolicy());
                dataSrc.close();
                VoTable table = VoTable.createVoTable(starTable, null, 1000000);
                table.setName(name);
                new VoCatalog(table); // Wraps the table in a local catalog for searching
                return table;
            }
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.