Java Byte Array from getBytesFromStream(int length, ByteArrayInputStream bais)

Here you can find the source of getBytesFromStream(int length, ByteArrayInputStream bais)

Description

get Bytes From Stream

License

Apache License

Declaration

public static byte[] getBytesFromStream(int length, ByteArrayInputStream bais) 

Method Source Code

//package com.java2s;
/**//from  w  w  w .j  a  v  a2  s  .c  o  m
 * Copyright 2011 Adrian Stabiszewski, as@nfctools.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.ByteArrayInputStream;

public class Main {
    public static byte[] getBytesFromStream(int length, ByteArrayInputStream bais) {
        byte[] bytes = new byte[length];
        bais.read(bytes, 0, bytes.length);
        return bytes;
    }
}

Related

  1. getBytesFromInt(int value)
  2. getBytesFromList(List values)
  3. getBytesFromObject(Serializable data)
  4. getBytesFromObject(Serializable obj)
  5. getBytesFromResource(String resource)
  6. getBytesFromString(final String str, final int length, final String coding)
  7. getBytesFromText(String text, String charset)
  8. getBytesInCodePage(final String string, final int codepage)
  9. getBytesInUsAscii(String s)

  10. HOME | Copyright © www.java2s.com 2016