Create an instance of {@link Bytes} that is created lazily and is of
the expected size.

@param creator
the creator of byte data
@param expectedSize
the expected size of the created byte data, used to allocate memory
for the data
@return
instance of bytes
491514
@NonNull
	static Bytes createViaLazyDataOutput(@NonNull IOConsumer<ExtendedDataOutput> creator, int expectedSize)
	{
		return new DataOutputBytes(creator, expectedSize);
	}
907245
@SuppressWarnings("unchecked")
    @Override
    public <T> T create(EntityCreateOperation<T> creator)
            throws ServiceException {
        creator.setProxyData(createProxyData());
        Object rawResponse = getResource(creator).post(
                creator.getResponseClass(), creator.getRequestContents());
        Object processedResponse = creator.processResponse(rawResponse);
        return (T) processedResponse;
    }
250036
@Nonnull
	public static <R> LByteFunctionBuilder<R> byteFunction(Consumer<LByteFunction<R>> consumer) {
		return new LByteFunctionBuilder(consumer);
	}
145745
public static byte[] toByteArray(InputStream in, int bufferSize) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        copyData(in, out, bufferSize);
        return out.toByteArray();
    }
228515
public byte[] getByteBuffer(int expected) {
		if (this.byteBuffer.length >= expected) {
			return byteBuffer;
		} else if (expected < MAX_SIZE) {
			// ?预先设置多一点
			byteBuffer = new byte[(int) (expected * 1.2)];
			return byteBuffer;
		} else {
			return EMPTY_BYTE_ARRAY;
		}

	}
357041
def SizeInBytes(sized_field, length, encoder=ENC_INT_DEFAULT, fuzzable=False, name=None):
    '''
    
    '''
    return Size(sized_field=sized_field, length=length, calc_func=lambda x: len(x) // 8, encoder=encoder, fuzzable=fuzzable, name=name)
405278
public static InStream create(String name, ByteBuffer input, CompressionCodec codec,
      int bufferSize) throws IOException {
    return create(name, input, codec, bufferSize, true);
  }
843868
public static MutableDoubleTuple createRandom(int size, Random random)
    {
       MutableDoubleTuple t = create(size);
       randomize(t, random);
       return t;
    }
42603
public static ByteBuffer allocateDirectBuffer(int size) {
    try {
      if (CLEANER_CREATE_METHOD == null) {
        // Can't set a Cleaner (see comments on field), so need to allocate via normal Java APIs
        try {
          return ByteBuffer.allocateDirect(size);
        } catch (OutOfMemoryError oome) {
          // checkstyle.off: RegexpSinglelineJava
          throw new OutOfMemoryError("Failed to allocate direct buffer (" + oome.getMessage() +
              "); try increasing -XX:MaxDirectMemorySize=... to, for example, your heap size");
          // checkstyle.on: RegexpSinglelineJava
        }
      }
      // Otherwise, use internal JDK APIs to allocate a DirectByteBuffer while ignoring the JVM's
      // MaxDirectMemorySize limit (the default limit is too low and we do not want to
      // require users to increase it).
      long memory = allocateMemory(size);
      ByteBuffer buffer = (ByteBuffer) DBB_CONSTRUCTOR.newInstance(memory, size);
      try {
        DBB_CLEANER_FIELD.set(buffer,
            CLEANER_CREATE_METHOD.invoke(null, buffer, (Runnable) () -> freeMemory(memory)));
      } catch (IllegalAccessException | InvocationTargetException e) {
        freeMemory(memory);
        throw new IllegalStateException(e);
      }
      return buffer;
    } catch (Exception e) {
      throwException(e);
    }
    throw new IllegalStateException("unreachable");
  }
6309
public static InStream create(String name, FSDataInputStream file, long streamOffset,
      int streamLength, CompressionCodec codec, int bufferSize) throws IOException {

    return create(name, file, streamOffset, streamLength, codec, bufferSize, true, 1);
  }
1286393
@FactoryMethod
    public static NotNullExpectation create(String expected )
    {
        String normalized = normalizeSpace(replaceChars(expected, '\u00A0', ' '));
        return "not null".equalsIgnoreCase(normalized) ?
               new NotNullExpectation() :
               null;
    }
13040
@Override
    public BigDecimal fromBytes(Class targetClass, byte[] bytes)
    {
        if (bytes == null)
        {
            return null;
        }
        int scale = (((bytes[0]) << 24) | ((bytes[1] & 0xff) << 16) | ((bytes[2] & 0xff) << 8) | ((bytes[3] & 0xff)));

        byte[] bibytes = Arrays.copyOfRange(bytes, 4, bytes.length);

        BigInteger bi = new BigInteger(bibytes);

        return new BigDecimal(bi, scale);
    }
22022
public static InStream create(String name, ByteBuffer input, CompressionCodec codec,
      int bufferSize, boolean useVInts) throws IOException {
    if (codec == null) {
      return new UncompressedStream(name, input, useVInts);
    } else {
      return new CompressedStream(name, input, codec, bufferSize, useVInts);
    }
  }
1281034
public static DynamicByteBuffer createExact( final int capacity ) {
        return new DynamicByteBuffer( capacity ) {
            public DynamicByteBuffer add( byte[] chars ) {
                DynamicByteBufferHelper._idx( buffer, length, chars );
                length += chars.length;
                return this;
            }
        };
    }
59206
@Override
    public BytesMessage createBytesMessage() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createBytesMessage");

        BytesMessage bytesMessage = null;

        try {
            bytesMessage = jmsSession.createBytesMessage();
        } catch (JMSException e) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(e, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createBytesMessage");
        }
        return bytesMessage;
    }
837810
public long sizeInBytes()
    {
        long n = 0;
        for (CacheBucket bucket : cache.asMap().values())
            for (RandomAccessReader reader : bucket.queue)
                n += reader.getTotalBufferSize();
        return n;
    }
14859
protected BytesBuff ensureCapacity(int addBytes) {
		if (addBytes < 0) {
			throw new IllegalArgumentException(String.format("addBytes: %d (expected: >= 0)", addBytes));
		}
		ensureCapacityUnsafe(addBytes);
		return this;
	}