Returns the byte representation of the whole CR structure.
<p>

@return byte array containing structure
506181
public byte[] toByteArray()
	{
		final ByteArrayOutputStream os = new ByteArrayOutputStream();
		os.write(length);
		os.write(connType);
		os.write(opt, 0, opt.length);
		return os.toByteArray();
	}
427419
public byte[] toByteArray()
	{
		final byte[] buf = super.toByteArray();
		int i = 2;
		for (final Iterator it = map.entrySet().iterator(); it.hasNext();) {
			final Map.Entry e = (Map.Entry) it.next();
			buf[i++] = ((Short) e.getKey()).byteValue();
			buf[i++] = ((Short) e.getValue()).byteValue();
		}
		return buf;
	}
475241
public byte[] toByteArray() {
        return collectSized(ByteBuffer::new, ByteBuffer::add, ByteBuffer::addAll, ByteBuffer::new,
            ByteBuffer::addUnsafe).toArray();
    }
1170775
public byte[] getBytes() {
		final int len = getVInt();
		final byte[] bytes = new byte[len];
		System.arraycopy(buf, bufPosition, bytes, 0, bytes.length);
		bufPosition += bytes.length;
		return bytes;
	}
132980
public byte[] getBytes() {
    final byte[] bytes = new byte[qualifier.length + value.length];
    System.arraycopy(this.qualifier, 0, bytes, 0, qualifier.length);
    System.arraycopy(value, 0, bytes, qualifier.length, value.length);
    return bytes;
  }
964216
public byte[] toByteArray()
    {
        byte[] b = new byte[size()];
        unsafe.copyMemory(base, address, b, ARRAY_BYTE_BASE_OFFSET, size());
        return b;
    }
1331538
public byte[] toByteArray() {
        // variable content size depending on sub authorities number
        final ByteBuffer buff = ByteBuffer.allocate(getSize());
        buff.put(revision);
        buff.put(NumberFacility.getBytes(subAuthorities.size())[3]);
        buff.put(identifierAuthority);
        for (byte[] sub : subAuthorities) {
            buff.put(Hex.reverse(sub));
        }
        return buff.array();
    }
1184118
public ByteBuffer getByteBuffer() {
		final ByteBuffer bb = ByteBuffer.wrap(buf);
		bb.limit(bufLimit);
		bb.position(bufPosition);
		return bb;
	}
947008
public com.google.protobuf.ByteString
      getProtocolBytes() {
    java.lang.Object ref = protocol_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      protocol_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
162307
public byte[] toByteArray() {
    switch (this.repr) {
      case P2:
      case P3:
        FieldElement recip = Z.invert();
        FieldElement x = X.multiply(recip);
        FieldElement y = Y.multiply(recip);
        byte[] s = y.toByteArray();
        s[s.length - 1] |= (x.isNegative() ? (byte) 0x80 : 0);
        return s;
      default:
        return toP2().toByteArray();
    }
  }
1231133
@Nonnull
  @ReturnsMutableCopy
  public byte [] getAsByteArray ()
  {
    final byte [] aArray = m_aBuffer.array ();
    final int nOfs = m_aBuffer.arrayOffset ();
    final int nLength = m_aBuffer.position ();

    return ArrayHelper.getCopy (aArray, nOfs, nLength);
  }
1007248
public char[] toCharArray()
    {
        // check if there is a cached single charbuffer
        if (firstChunk == lastChunk && firstChunk instanceof CharBufferChunk
                && allocBuffer.charsUsed() == 0
                && ((CharBufferChunk) firstChunk).isSingleBuffer())
        {
            return ((CharBufferChunk) firstChunk).buffer;
        }

        int initialReaderCount = readerCount;
        char[] buf = readAsCharArray();
        if (initialReaderCount == 0)
        {
            // if there are no readers, the result can be cached
            reset();
            if (buf.length > 0)
            {
                addChunk(new CharBufferChunk(-1, buf, 0, buf.length));
            }
        }
        return buf;
    }
102004
private byte[] getSchemaBytes() {

        StringBuffer schema = new StringBuffer(512);
        schema.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        schema.append("<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\">");
        Iterator<I_CmsXmlSchemaType> i = m_registeredTypes.values().iterator();
        while (i.hasNext()) {
            I_CmsXmlSchemaType type = i.next();
            schema.append(type.getSchemaDefinition());
        }
        schema.append("</xsd:schema>");
        String schemaStr = schema.toString();

        try {
            // pretty print the XML schema
            // this helps in debugging the auto-generated schema includes
            // since it makes them more human-readable
            Document doc = CmsXmlUtils.unmarshalHelper(schemaStr, null);
            schemaStr = CmsXmlUtils.marshal(doc, CmsEncoder.ENCODING_UTF_8);
        } catch (CmsXmlException e) {
            // should not ever happen
            LOG.error(Messages.get().getBundle().key(Messages.LOG_PRETTY_PRINT_SCHEMA_BYTES_ERROR_0), e);
        }
        if (LOG.isInfoEnabled()) {
            LOG.info(
                Messages.get().getBundle().key(
                    Messages.LOG_XML_TYPE_DEFINITION_XSD_2,
                    CmsXmlContentDefinition.XSD_INCLUDE_OPENCMS,
                    schemaStr));
        }
        try {
            return schemaStr.getBytes(CmsEncoder.ENCODING_UTF_8);
        } catch (UnsupportedEncodingException e) {
            // should not happen since the default encoding of UTF-8 is always valid
            LOG.error(Messages.get().getBundle().key(Messages.LOG_CONVERTING_SCHEMA_BYTES_ERROR_0), e);
        }
        return null;
    }
636668
public static byte[] readRawBytes(ByteBuf cb)
    {
        byte[] bytes = new byte[cb.readableBytes()];
        cb.readBytes(bytes);
        return bytes;
    }
1216034
public byte checksum() {
    if(DEBUG_LEV > 10 )
      System.err.println("CRC8::checksum : Begin");
    //add 8 to the count,
    //call update with a byte constructed to add no more.
    //byte[] fake = {0};
    workingCRC8Count += 8;
    byte val = updateCRC8(fake, 0, 1);
    if(DEBUG_LEV > 10 )
      System.err.println("CRC8::checksum : End");
    return val;
  }
772325
public byte[] getKeySetToByteArray() 
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        
        char[] buffer = new char[getMaxFieldLenth()];
        
        try
        {
            for ( String s : keys )
            {
                Arrays.fill(buffer, (char)0);
                System.arraycopy( s.toCharArray(), 0, buffer, 0, s.length() );
                dos.writeBytes( new String(buffer) );
            }
        }
        catch  (IOException e)
        {
            System.err.println("Could not write Structure key set to byte array: " + e );
            return new byte[0];
        }
        return baos.toByteArray();
        
    }
1322845
public byte[] toByteArray()
	{
		final byte[] r = new byte[size];
		int off = 0;
		final int n = arrays.size();
		for(int k = 0; k < n; k++) {
			byte[] src = (byte[])arrays.get(k);
			System.arraycopy(src, 0, r, off, src.length);
			off += src.length;
		}
		if(pos > 0) System.arraycopy(buffer, 0, r, off, pos);
		return r;
	}