src/main/java/com/allantaborda/ooogg/Tags.java
public void fromOggPacket(OggPacket packet){
		byte[] content = packet.getContent();
		int pos = packetHeader == null ? 0 : packetHeader.length();
		if(pos > 0){
			byte[] b = new byte[pos];
			System.arraycopy(content, 0, b, 0, pos);
			if(!packetHeader.equals(new String(b))) valid = false;
		}
		if(valid){
			byte[] b = new byte[4];
			System.arraycopy(content, pos, b, 0, b.length);
			pos += b.length;
			b = new byte[OggUtils.getIntFromByteArray(b)];
			System.arraycopy(content, pos, b, 0, b.length);
			pos += b.length;
			setVendor(new String(b, UTF_8));
			b = new byte[4];
			System.arraycopy(content, pos, b, 0, b.length);
			pos += b.length;
			for(int c = 0, nrValues = OggUtils.getIntFromByteArray(b); c < nrValues; c++){
				b = new byte[4];
				System.arraycopy(content, pos, b, 0, b.length);
				pos += b.length;
				b = new byte[OggUtils.getIntFromByteArray(b)];
				System.arraycopy(content, pos, b, 0, b.length);
				pos += b.length;
				String kv = new String(b, UTF_8);
				int eq = kv.indexOf('=');
				add(kv.substring(0, eq), kv.substring(eq + 1));
			}
		}
		if(includeFramingBit){
			if(packet.getSize() <= pos || content[pos] != (byte) 0x01 || packet.getSize() > ++pos) valid = false;
		}else if(packet.getSize() > pos) valid = false;
	}
/**
	 * Loads the content from an OGG packet.
	 * @param packet The OGG packet in which data will be loaded.
	 */
Loads the content from an OGG packet.
@param packet The OGG packet in which data will be loaded.
Loads the content from an OGG packet . @param packet The OGG packet in which data will be loaded .
public void fromOggPacket(OggPacket packet){
		byte[] content = packet.getContent();
		int pos = packetHeader == null ? 0 : packetHeader.length();
		if(pos > 0){
			byte[] b = new byte[pos];
			System.arraycopy(content, 0, b, 0, pos);
			if(!packetHeader.equals(new String(b))) valid = false;
		}
		if(valid){
			byte[] b = new byte[4];
			System.arraycopy(content, pos, b, 0, b.length);
			pos += b.length;
			b = new byte[OggUtils.getIntFromByteArray(b)];
			System.arraycopy(content, pos, b, 0, b.length);
			pos += b.length;
			setVendor(new String(b, UTF_8));
			b = new byte[4];
			System.arraycopy(content, pos, b, 0, b.length);
			pos += b.length;
			for(int c = 0, nrValues = OggUtils.getIntFromByteArray(b); c < nrValues; c++){
				b = new byte[4];
				System.arraycopy(content, pos, b, 0, b.length);
				pos += b.length;
				b = new byte[OggUtils.getIntFromByteArray(b)];
				System.arraycopy(content, pos, b, 0, b.length);
				pos += b.length;
				String kv = new String(b, UTF_8);
				int eq = kv.indexOf('=');
				add(kv.substring(0, eq), kv.substring(eq + 1));
			}
		}
		if(includeFramingBit){
			if(packet.getSize() <= pos || content[pos] != (byte) 0x01 || packet.getSize() > ++pos) valid = false;
		}else if(packet.getSize() > pos) valid = false;
	}
public void fromOggPacket ( OggPacket packet ) { byte [ ] content = packet . getContent ( ) ; int pos = packetHeader == null ? 0 : packetHeader . length ( ) ; if ( pos > 0 ) { byte [ ] b = new byte [ pos ] ; System . arraycopy ( content , 0 , b , 0 , pos ) ; if ( ! packetHeader . equals ( new String ( b ) ) ) valid = false ; } if ( valid ) { byte [ ] b = new byte [ 4 ] ; System . arraycopy ( content , pos , b , 0 , b . length ) ; pos += b . length ; b = new byte [ OggUtils . getIntFromByteArray ( b ) ] ; System . arraycopy ( content , pos , b , 0 , b . length ) ; pos += b . length ; setVendor ( new String ( b , UTF_8 ) ) ; b = new byte [ 4 ] ; System . arraycopy ( content , pos , b , 0 , b . length ) ; pos += b . length ; for ( int c = 0 , nrValues = OggUtils . getIntFromByteArray ( b ) ; c < nrValues ; c ++ ) { b = new byte [ 4 ] ; System . arraycopy ( content , pos , b , 0 , b . length ) ; pos += b . length ; b = new byte [ OggUtils . getIntFromByteArray ( b ) ] ; System . arraycopy ( content , pos , b , 0 , b . length ) ; pos += b . length ; String kv = new String ( b , UTF_8 ) ; int eq = kv . indexOf ( '=' ) ; add ( kv . substring ( 0 , eq ) , kv . substring ( eq + 1 ) ) ; } } if ( includeFramingBit ) { if ( packet . getSize ( ) <= pos || content [ pos ] != ( byte ) 0x01 || packet . getSize ( ) > ++ pos ) valid = false ; } else if ( packet . getSize ( ) > pos ) valid = false ; }
Loads the content from an OGG packet.
Loads the content from an OGG packet .