src/main/java/com/allantaborda/ooogg/OggPacket.java
private byte[][] split(byte[] content){
		if(content.length < 256){
			if(content.length == 255){
				byte[][] op = new byte[2][];
				op[0] = content;
				op[1] = new byte[0];
				return op;
			}else{
				byte[][] op = new byte[1][];
				op[0] = content;
				return op;
			}
		}
		LinkedList<byte[]> bs = new LinkedList<>();
		do{
			byte[] p1 = new byte[255], p2 = new byte[content.length - 255];
			System.arraycopy(content, 0, p1, 0, 255);
			System.arraycopy(content, 255, p2, 0, p2.length);
			bs.add(p1);
			content = p2;
		}while(content.length > 255);
		for(byte[] p : split(content)) bs.add(p);
		byte[][] op = new byte[bs.size()][];
		int c = -1;
		for(byte[] p : bs) op[++c] = p;
		return op;
	}
/**
	 * Splits OGG packet content in segments.
	 * @param content The OGG packet content.
	 * @return The OGG packet segments.
	 */
Splits OGG packet content in segments.
@param content The OGG packet content.
@return The OGG packet segments.
Splits OGG packet content in segments . @param content The OGG packet content . @return The OGG packet segments .
private byte[][] split(byte[] content){
		if(content.length < 256){
			if(content.length == 255){
				byte[][] op = new byte[2][];
				op[0] = content;
				op[1] = new byte[0];
				return op;
			}else{
				byte[][] op = new byte[1][];
				op[0] = content;
				return op;
			}
		}
		LinkedList<byte[]> bs = new LinkedList<>();
		do{
			byte[] p1 = new byte[255], p2 = new byte[content.length - 255];
			System.arraycopy(content, 0, p1, 0, 255);
			System.arraycopy(content, 255, p2, 0, p2.length);
			bs.add(p1);
			content = p2;
		}while(content.length > 255);
		for(byte[] p : split(content)) bs.add(p);
		byte[][] op = new byte[bs.size()][];
		int c = -1;
		for(byte[] p : bs) op[++c] = p;
		return op;
	}
private byte [ ] [ ] split ( byte [ ] content ) { if ( content . length < 256 ) { if ( content . length == 255 ) { byte [ ] [ ] op = new byte [ 2 ] [ ] ; op [ 0 ] = content ; op [ 1 ] = new byte [ 0 ] ; return op ; } else { byte [ ] [ ] op = new byte [ 1 ] [ ] ; op [ 0 ] = content ; return op ; } } LinkedList < byte [ ] > bs = new LinkedList < > ( ) ; do { byte [ ] p1 = new byte [ 255 ] , p2 = new byte [ content . length - 255 ] ; System . arraycopy ( content , 0 , p1 , 0 , 255 ) ; System . arraycopy ( content , 255 , p2 , 0 , p2 . length ) ; bs . add ( p1 ) ; content = p2 ; } while ( content . length > 255 ) ; for ( byte [ ] p : split ( content ) ) bs . add ( p ) ; byte [ ] [ ] op = new byte [ bs . size ( ) ] [ ] ; int c = - 1 ; for ( byte [ ] p : bs ) op [ ++ c ] = p ; return op ; }
Splits OGG packet content in segments.
Splits OGG packet content in segments .