common/src/main/java/com/genexus/GXParameterPacker.java
/**
	* Converts the buffer to a byte array of the size of the buffer
	* @since Beta1
	*/
Converts the buffer to a byte array of the size of the buffer
@since Beta1
Converts the buffer to a byte array of the size of the buffer @since Beta1
public final byte[] toByteArray()
	{
		byte[] returnBuffer;
		if	(COMPRESS)
		{
			if	(needsCompressing(count))
			{
				try
				{
					ByteArrayOutputStream bytes = new ByteArrayOutputStream(count);
					GZIPOutputStream 	  zip   = new GZIPOutputStream(bytes);
					zip.write(buf, 0, count);
					zip.close();
					byte[] zipped = bytes.toByteArray();
					returnBuffer = new byte[zipped.length + 1];
					returnBuffer[0] = 1;
					System.arraycopy(zipped, 0, returnBuffer, 1, zipped.length);
				}
				catch (IOException e)
				{
					System.err.println("Exception compressing output - sending uncompressed");
					returnBuffer = new byte[count + 1];
					System.arraycopy(buf, 0, returnBuffer, 1, count);
				}
			}
			else
			{
				if	(count == 0)
					return new byte[0];
				returnBuffer = new byte[count + 1];
				System.arraycopy(buf, 0, returnBuffer, 1, count);
			}
		}
		else
		{
			returnBuffer = new byte[count];
			System.arraycopy(buf, 0, returnBuffer, 0, count);
		}
		return returnBuffer;
    }
public final byte [ ] toByteArray ( ) { byte [ ] returnBuffer ; if ( COMPRESS ) { if ( needsCompressing ( count ) ) { try { ByteArrayOutputStream bytes = new ByteArrayOutputStream ( count ) ; GZIPOutputStream zip = new GZIPOutputStream ( bytes ) ; zip . write ( buf , 0 , count ) ; zip . close ( ) ; byte [ ] zipped = bytes . toByteArray ( ) ; returnBuffer = new byte [ zipped . length + 1 ] ; returnBuffer [ 0 ] = 1 ; System . arraycopy ( zipped , 0 , returnBuffer , 1 , zipped . length ) ; } catch ( IOException e ) { System . err . println ( "Exception compressing output - sending uncompressed" ) ; returnBuffer = new byte [ count + 1 ] ; System . arraycopy ( buf , 0 , returnBuffer , 1 , count ) ; } } else { if ( count == 0 ) return new byte [ 0 ] ; returnBuffer = new byte [ count + 1 ] ; System . arraycopy ( buf , 0 , returnBuffer , 1 , count ) ; } } else { returnBuffer = new byte [ count ] ; System . arraycopy ( buf , 0 , returnBuffer , 0 , count ) ; } return returnBuffer ; }
Converts the buffer to a byte array of the size of the buffer
 @since Beta1
Converts the buffer to a byte array of the size of the buffer @since Beta1
// Si no tiene nada, mando vacio, ya se avivara el unpacker. // Si no hay que comprimir, mando descomprimido.