Commit 390f6c3a authored by Andrea Zoli's avatar Andrea Zoli
Browse files

Add OutputPacketStream::writePacket(ByteStreamPtr bs).

parent a777f58b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -34,8 +34,11 @@ public:

    OutputPacketStream(const char* fileNameConfig);

    /// Generate the output ByteStream and send it to the output.
    bool writePacket(Packet* p) throw(PacketExceptionIO*);
    /// Generate the output ByteStream and write to the output.
    void writePacket(Packet* p) throw(PacketExceptionIO*);

    /// Write a ByteStream to the output.
    void writePacket(ByteStreamPtr bs) throw(PacketExceptionIO*);

    void setOutput(Output* out);

+6 −6
Original line number Diff line number Diff line
@@ -33,16 +33,18 @@ OutputPacketStream::OutputPacketStream(const char* fileNameConfig) : PacketStrea
}


bool OutputPacketStream::writePacket(Packet* p) throw(PacketExceptionIO*)
void OutputPacketStream::writePacket(Packet* p) throw(PacketExceptionIO*)
{
	writePacket(p->getOutputStream());
}

void OutputPacketStream::writePacket(ByteStreamPtr bs) throw(PacketExceptionIO*)
{
    ByteStreamPtr bs;
    try
    {
        bs = p->getOutputStream();
        if(out == 0)
            throw new PacketExceptionIO("No output set..");
        out->writeByteStream(bs);
        return true;
    }
    catch(PacketExceptionIO* e)
    {
@@ -52,8 +54,6 @@ bool OutputPacketStream::writePacket(Packet* p) throw(PacketExceptionIO*)
    }
}



void OutputPacketStream::setOutput(Output* out)
{
    this->out = out;