当前位置: 首页>>代码示例>>Java>>正文


Java Streams.readFully方法代码示例

本文整理汇总了Java中org.bouncycastle.util.io.Streams.readFully方法的典型用法代码示例。如果您正苦于以下问题:Java Streams.readFully方法的具体用法?Java Streams.readFully怎么用?Java Streams.readFully使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.util.io.Streams的用法示例。


在下文中一共展示了Streams.readFully方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toByteArray

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
byte[] toByteArray()
    throws IOException
{
    if (_remaining == 0)
    {
        return EMPTY_BYTES;
    }

    byte[] bytes = new byte[_remaining];
    if ((_remaining -= Streams.readFully(_in, bytes)) != 0)
    {
        throw new EOFException("DEF length " + _originalLength + " object truncated by " + _remaining);
    }
    setParentEofDetect(true);
    return bytes;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:17,代码来源:DefiniteLengthInputStream.java

示例2: getBuffer

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
private static byte[] getBuffer(DefiniteLengthInputStream defIn, byte[][] tmpBuffers)
    throws IOException
{
    int len = defIn.getRemaining();
    if (defIn.getRemaining() < tmpBuffers.length)
    {
        byte[] buf = tmpBuffers[len];

        if (buf == null)
        {
            buf = tmpBuffers[len] = new byte[len];
        }

        Streams.readFully(defIn, buf);

        return buf;
    }
    else
    {
        return defIn.toByteArray();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:ASN1InputStream.java

示例3: fromInputStream

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
static DERBitString fromInputStream(int length, InputStream stream)
    throws IOException
{
    if (length < 1)
    {
        throw new IllegalArgumentException("truncated BIT STRING detected");
    }

    int padBits = stream.read();
    byte[] data = new byte[length - 1];

    if (data.length != 0)
    {
        if (Streams.readFully(stream, data) != data.length)
        {
            throw new EOFException("EOF encountered in middle of BIT STRING");
        }
    }

    return new DERBitString(data, padBits);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:DERBitString.java

示例4: readAllOrNothing

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
public static byte[] readAllOrNothing(int length, InputStream input)
    throws IOException
{
    if (length < 1)
    {
        return EMPTY_BYTES;
    }
    byte[] buf = new byte[length];
    int read = Streams.readFully(input, buf);
    if (read == 0)
    {
        return null;
    }
    if (read != length)
    {
        throw new EOFException();
    }
    return buf;
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:20,代码来源:TlsUtils.java

示例5: readFully

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
protected void readFully(
    byte[]  bytes)
    throws IOException
{
    if (Streams.readFully(this, bytes) != bytes.length)
    {
        throw new EOFException("EOF encountered in middle of object");
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:10,代码来源:ASN1InputStream.java

示例6: readFully

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
public static byte[] readFully(int length, InputStream input)
    throws IOException
{
    if (length < 1)
    {
        return EMPTY_BYTES;
    }
    byte[] buf = new byte[length];
    if (length != Streams.readFully(input, buf))
    {
        throw new EOFException();
    }
    return buf;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:15,代码来源:TlsUtils.java

示例7: readFully

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
public void readFully(
    byte[]    buf,
    int       off,
    int       len)
    throws IOException
{
    if (Streams.readFully(this, buf, off, len) < len)
    {
        throw new EOFException();
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:12,代码来源:BCPGInputStream.java

示例8: readBytes

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
static byte[] readBytes(InputStream in, int ch)
    throws IOException
{
    int len = readLength(in, ch);

    byte[] data = new byte[len];

    Streams.readFully(in, data);

    return data;
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:12,代码来源:SXprUtils.java

示例9: readFully

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
public static void readFully(byte[] buf, InputStream input)
    throws IOException
{
    int length = buf.length;
    if (length > 0 && length != Streams.readFully(input, buf))
    {
        throw new EOFException();
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:10,代码来源:TlsUtils.java

示例10: readKey

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
public AsymmetricKeyParameter readKey(InputStream stream)
    throws IOException
{
    byte[] V;
    int    first = stream.read();

    // Decode the public ephemeral key
    switch (first)
    {
    case 0x00: // infinity
        throw new IOException("Sender's public key invalid.");

    case 0x02: // compressed
    case 0x03: // Byte length calculated as in ECPoint.getEncoded();
        V = new byte[1 + (ecParams.getCurve().getFieldSize()+7)/8];
        break;

    case 0x04: // uncompressed or
    case 0x06: // hybrid
    case 0x07: // Byte length calculated as in ECPoint.getEncoded();
        V = new byte[1 + 2*((ecParams.getCurve().getFieldSize()+7)/8)];
        break;

    default:
        throw new IOException("Sender's public key has invalid point encoding 0x" + Integer.toString(first, 16));
    }

    V[0] = (byte)first;
    Streams.readFully(stream, V, 1, V.length - 1);

    return new ECPublicKeyParameters(ecParams.getCurve().decodePoint(V), ecParams);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:33,代码来源:ECIESPublicKeyParser.java

示例11: readKey

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
public AsymmetricKeyParameter readKey(InputStream stream)
    throws IOException
{
    byte[] V = new byte[(dhParams.getP().bitLength() + 7) / 8];

    Streams.readFully(stream, V, 0, V.length);

    return new DHPublicKeyParameters(new BigInteger(1, V), dhParams);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:10,代码来源:DHIESPublicKeyParser.java

示例12: fromInputStream

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
static ASN1BitString fromInputStream(int length, InputStream stream)
    throws IOException
{
    if (length < 1)
    {
        throw new IllegalArgumentException("truncated BIT STRING detected");
    }

    int padBits = stream.read();
    byte[] data = new byte[length - 1];

    if (data.length != 0)
    {
        if (Streams.readFully(stream, data) != data.length)
        {
            throw new EOFException("EOF encountered in middle of BIT STRING");
        }

        if (padBits > 0 && padBits < 8)
        {
            if (data[data.length - 1] != (byte)(data[data.length - 1] & (0xff << padBits)))
            {
                return new DLBitString(data, padBits);
            }
        }
    }

    return new DERBitString(data, padBits);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:30,代码来源:ASN1BitString.java

示例13: readNbBytes

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
private byte[] readNbBytes(InputStream s, int length) throws IOException {
	byte[] array = new byte[length];
	if (Streams.readFully(s, array) != length) {
		LOG.warn("Cannot read expected length!");
	}
	return array;
}
 
开发者ID:esig,项目名称:dss,代码行数:8,代码来源:CRLParser.java

示例14: decodeUint32

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
private long decodeUint32(InputStream inputStream) throws IOException, X10FlashException {
	byte[] buff = new byte[4];
	if (Streams.readFully(inputStream, buff) != 4)
	{
		throw new X10FlashException("Not enough data to read Uint32 when decoding command");
	}
	long longval = ByteBuffer.wrap(buff).getInt();
	return  longval & 0xFFFFFFFF;
}
 
开发者ID:Androxyde,项目名称:Flashtool,代码行数:10,代码来源:S1Flasher.java

示例15: readFully

import org.bouncycastle.util.io.Streams; //导入方法依赖的package包/类
protected static void readFully(byte[] buf, InputStream is) throws IOException
{
    if (Streams.readFully(is, buf) != buf.length)
    {
        throw new EOFException();
    }
}
 
开发者ID:coova,项目名称:jradius,代码行数:8,代码来源:TlsUtils.java


注:本文中的org.bouncycastle.util.io.Streams.readFully方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。