src/main/java/com/allantaborda/ooogg/OggPage.java
public byte[][] addPacket(OggPackable packet){
		if(packet.isValid()){
			boolean full = false;
			ArrayList<byte[]> overplus = new ArrayList<>(100);
			for(byte[] seg : packet.toOggPacket().getSegments()){
				if(!full) full = !addSegment(seg);
				if(full) overplus.add(seg);
			}
			return overplus.isEmpty() ? null : overplus.toArray(new byte[overplus.size()][]);
		}else throw new IllegalArgumentException("Invalid OGG packet");
	}
/**
	 * Adds an OGG packet to OGG page.
	 * @param packet The OGG packet.
	 * @return The overplus segments that don't fit in OGG page, or {@code null} if no overplus segments.
	 * @throws IllegalArgumentException If OGG packet is not valid.
	 */
Adds an OGG packet to OGG page.
@param packet The OGG packet.
@return The overplus segments that don't fit in OGG page, or  null if no overplus segments.
@throws IllegalArgumentException If OGG packet is not valid.
Adds an OGG packet to OGG page . @param packet The OGG packet . @return The overplus segments that don ' t fit in OGG page or null if no overplus segments . @throws IllegalArgumentException If OGG packet is not valid .
public byte[][] addPacket(OggPackable packet){
		if(packet.isValid()){
			boolean full = false;
			ArrayList<byte[]> overplus = new ArrayList<>(100);
			for(byte[] seg : packet.toOggPacket().getSegments()){
				if(!full) full = !addSegment(seg);
				if(full) overplus.add(seg);
			}
			return overplus.isEmpty() ? null : overplus.toArray(new byte[overplus.size()][]);
		}else throw new IllegalArgumentException("Invalid OGG packet");
	}
public byte [ ] [ ] addPacket ( OggPackable packet ) { if ( packet . isValid ( ) ) { boolean full = false ; ArrayList < byte [ ] > overplus = new ArrayList < > ( 100 ) ; for ( byte [ ] seg : packet . toOggPacket ( ) . getSegments ( ) ) { if ( ! full ) full = ! addSegment ( seg ) ; if ( full ) overplus . add ( seg ) ; } return overplus . isEmpty ( ) ? null : overplus . toArray ( new byte [ overplus . size ( ) ] [ ] ) ; } else throw new IllegalArgumentException ( "Invalid OGG packet" ) ; }
Adds an OGG packet to OGG page.
Adds an OGG packet to OGG page .