/** * Constructor for the <code>PartEntryConsumer</code> object. This * is used to create a consumer that will read the message part * and the boundary that terminates the part. All contents that * are read are appended to an internal buffer. * * @param allocator this is the allocator used for the buffer * @param series this is the list used to accumulate the parts * @param terminal this is the terminal token for the part list * @param length this is the length of the parent part series */ public PartEntryConsumer(Allocator allocator, PartSeries series, byte[] terminal, long length) { this.consumer = new PartConsumer(allocator, series, terminal, length); this.boundary = new BoundaryConsumer(allocator, terminal); }
/** * This is used to consume the part body from the cursor. This * initially reads the body of the part, which represents the * actual payload exposed via the <code>Part</code> interface * once the payload has been consumed the terminal is consumed. * * @param cursor this is the cursor to consume the body from */ public void consume(Cursor cursor) throws IOException { while(cursor.isReady()) { if(header.isFinished()) { if(body == null) { body = getConsumer(); current = body; } else { if(body.isFinished()) break; } } current.consume(cursor); } }
/** * This is used to consume the part body from the cursor. This * initially reads the body of the part, which represents the * actual payload exposed via the <code>Part</code> interface * once the payload has been consumed the terminal is consumed. * * @param cursor this is the cursor to consume the body from */ public void consume(ByteCursor cursor) throws IOException { while(cursor.isReady()) { if(header.isFinished()) { if(body == null) { body = getConsumer(); current = body; } else { if(body.isFinished()) break; } } current.consume(cursor); } }
/** * Constructor for the <code>PartEntryConsumer</code> object. This * is used to create a consumer that will read the message part * and the boundary that terminates the part. All contents that * are read are appended to an internal buffer. * * @param allocator this is the allocator used for the buffer * @param series this is the list used to accumulate the parts * @param terminal this is the terminal token for the part list * @param length this is the length of the parent part series */ public PartEntryConsumer(Allocator allocator, PartSeries series, byte[] terminal, long length) { this.consumer = new PartConsumer(allocator, series, terminal, length); this.boundary = new BoundaryConsumer(allocator, terminal); }
/** * This is used to consume the part body from the cursor. This * initially reads the body of the part, which represents the * actual payload exposed via the <code>Part</code> interface * once the payload has been consumed the terminal is consumed. * * @param cursor this is the cursor to consume the body from */ public void consume(ByteCursor cursor) throws IOException { while(cursor.isReady()) { if(header.isFinished()) { if(body == null) { body = getConsumer(); current = body; } else { if(body.isFinished()) break; } } current.consume(cursor); } }
/** * Constructor for the <code>PartEntryConsumer</code> object. This * is used to create a consumer that will read the message part * and the boundary that terminates the part. All contents that * are read are appended to an internal buffer. * * @param allocator this is the allocator used for the buffer * @param series this is the list used to accumulate the parts * @param terminal this is the terminal token for the part list * @param length this is the length of the parent part series */ public PartEntryConsumer(Allocator allocator, PartSeries series, byte[] terminal, long length) { this.consumer = new PartConsumer(allocator, series, terminal, length); this.boundary = new BoundaryConsumer(allocator, terminal); }