Reads all data from the input stream to a byte array.

@param pInput The input stream to read from
@return The content of the stream as a byte array.
@throws IOException if an i/o error occurs during read.
353674
public static byte[] read(InputStream pInput) throws IOException {
        // Create byte array
        ByteArrayOutputStream bytes = new FastByteArrayOutputStream(BUF_SIZE);

        // Copy from stream to byte array
        copy(pInput, bytes);

        return bytes.toByteArray();
    }
420427
def read(pin):
    '''
    '''
    f = _open[pin].value
    out = int(_read(f))
    log.debug("Read {0}: {1}".format(pin, out))
    return out
484437
public static byte[] unmarshallByteArray(ObjectInput in) throws IOException {
      final int size = unmarshallSize(in);
      if (size == NULL_VALUE) {
         return null;
      } else if (size == 0) {
         return Util.EMPTY_BYTE_ARRAY;
      }
      byte[] array = new byte[size];
      in.readFully(array);
      return array;
   }
814965
public InputStream getInputStreamFromOffset(int offset) throws IOException {
        loadFileData();
        return new ByteArrayInputStream(data, offset, data.length - offset);
    }
422585
public void readData(DataInput input) throws IOException {
        readReference = input.readUnsignedShort();
        readCount = input.readUnsignedShort();
        writeReference = input.readUnsignedShort();
        writeCount = input.readUnsignedShort();
        int byteCount = input.readUnsignedByte();

        if (nonWordDataHandler == null) {
            byte buffer[] = new byte[byteCount];
            input.readFully(buffer, 0, byteCount);

            int offset = 0;
            registers = new Register[writeCount];

            for (int register = 0; register < writeCount; register++) {
                registers[register] = new SimpleRegister(buffer[offset], buffer[offset + 1]);
                offset += 2;
            }
        }
        else {
            nonWordDataHandler.readData(input, writeReference, writeCount);
        }
    }
1109143
public byte[] getBytes() throws IOException {
        if (!connection.isOpen())
            connection.open();

        connection.prepare("GET");
        response = connection.readInput();
        return getResponseBytes();
    }
1272500
public static byte[] absorbInputStream(InputStream input) throws IOException {
		ByteArrayOutputStream output = null;
		try{
			output = new ByteArrayOutputStream();
			absorbInputStream(input, output);
			return output.toByteArray();
		} finally {
			output.close();
		}
	}
616524
private static byte[] decodeBytes(byte[] pInBytes) {
        byte[] decodabet = DECODABET;

        int    len34   = pInBytes.length * 3 / 4;       // Estimate on array size
        byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
        int    outBuffPosn = 0;             // Keep track of where we're writing

        byte[] b4        = new byte[4];     // Four byte buffer from source, eliminating white space
        int    b4Posn    = 0;               // Keep track of four byte input buffer
        int    i         = 0;               // Source array counter
        byte   sbiCrop   = 0;               // Low seven bits (ASCII) of input
        byte   sbiDecode = 0;               // Special value from DECODABET

        for( i = 0; i < 0 + pInBytes.length; i++ ) {  // Loop through source

            sbiCrop = (byte)(pInBytes[i] & 0x7f); // Only the low seven bits
            sbiDecode = decodabet[ sbiCrop ];   // Special value

            // White space, Equals sign, or legit Base64 character
            // Note the values such as -5 and -9 in the
            // DECODABETs at the top of the file.
            if( sbiDecode >= WHITE_SPACE_ENC )  {
                if( sbiDecode >= EQUALS_SIGN_ENC ) {
                    b4[ b4Posn++ ] = sbiCrop;           // Save non-whitespace
                    if( b4Posn > 3 ) {                  // Time to decode?
                        outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn);
                        b4Posn = 0;

                        // If that was the equals sign, break out of 'for' loop
                        if( sbiCrop == EQUALS_SIGN ) {
                            break;
                        }
                    }
                }
            }
            else {
                // There's a bad input character in the Base64 stream.
                throw new IllegalArgumentException(String.format(
                        "Bad Base64 input character '%d' in array position %d", pInBytes[i], i ) );
            }
        }

        byte[] out = new byte[ outBuffPosn ];
        System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
        return out;
    }
307079
public static String readStringOpt(DataInput in) throws IOException {
    final int length = WritableUtils.readVInt(in);
    if (length == NULL_STRING_LENGTH) {
      return null;
    }
    byte [] bytes = new byte[length];
    in.readFully(bytes, 0, length);
    char[] charArray = UTF8.getCharArray(length);
    for (int i = 0; i < bytes.length; i++) {
      if (bytes[i] < UTF8.MIN_ASCII_CODE) {
        // non-ASCII codepoints' higher bytes
        // are of the form (10xxxxxx), hence the bytes
        // represent a non-ASCII string
        // do expensive conversion
        return decode(bytes);
      }
      // copy to temporary array
      charArray[i] = (char) bytes[i];
    }
    // only ASCII bytes, do fast conversion
    // using bytes as actual characters
    return new String(charArray, 0, length);
  }
275348
public void readArray(int[] data) throws IOException {
        int size = data.length;
        for (int i = 0; i < size; ++i)
            data[i] = getInt();
    }
993187
public byte read(int offset) throws IOException {
		if (ensureBuffer(offset, 1) > 0) {
			this.pos = offset + 1;
			return this.buffer[offset];
		}
		throw new EOFException();
	}
962106
public int readFrom(InputStream stream) throws IOException {
        int bytesRead = stream.read(buffer);
        if (bytesRead < 0) {
            bytesInBuffer = 0;
        } else {
            bytesInBuffer = bytesRead;
        }
        return bytesRead;
    }
780281
public void writeInt(int pInt) throws IOException {
        file.write(pInt & 0xFF);
        file.write((pInt >>> 8) & 0xFF);
        file.write((pInt >>> 16) & 0xFF);
        file.write((pInt >>> 24) & 0xFF);
    }
741668
static String readPascalString(final DataInput pInput) throws IOException {
        int length = pInput.readUnsignedByte();

        if (length == 0) {
            return "";
        }

        byte[] bytes = new byte[length];
        pInput.readFully(bytes);

        return StringUtil.decode(bytes, 0, bytes.length, "ASCII");
    }
649523
public static void readbytes_into(InputStream input, byte[] buffer, int offset, int length) throws IOException {
		while (length > 0) {
			int read = input.read(buffer, offset, length);
			if (read == -1)
				throw new IOException("expected more bytes in input stream");
			offset += read;
			length -= read;
		}
	}
125953
@Override
    public int read(byte[] out) throws IOException {
        int i, off = 0;
        while (off < out.length && (i = in.read(out, off, out.length - off)) > 0) {
            off += i;
        }
        return off;
    }
963662
private void read(final DataInput pInput) throws IOException {
        byte[] bytes = new byte[64];
        pInput.readFully(bytes);

        // NOTE: Length is in bytes, including the null-terminator...
        int nameLength = pInput.readShort();
        name = new String(bytes, 0, nameLength - 2, Charset.forName("UTF-16LE"));
//        System.out.println("name: " + name);

        type = pInput.readByte();
//        System.out.println("type: " + type);

        nodeColor = pInput.readByte();
//        System.out.println("nodeColor: " + nodeColor);

        prevDId = pInput.readInt();
//        System.out.println("prevDId: " + prevDId);
        nextDId = pInput.readInt();
//        System.out.println("nextDId: " + nextDId);
        rootNodeDId = pInput.readInt();
//        System.out.println("rootNodeDId: " + rootNodeDId);

        // UID (16) + user flags (4), ignored
        if (pInput.skipBytes(20) != 20) {
            throw new CorruptDocumentException();
        }

        createdTimestamp = CompoundDocument.toJavaTimeInMillis(pInput.readLong());
        modifiedTimestamp = CompoundDocument.toJavaTimeInMillis(pInput.readLong());

        startSId = pInput.readInt();
//        System.out.println("startSId: " + startSId);
        streamSize = pInput.readInt();
//        System.out.println("streamSize: " + streamSize);

        // Reserved
        pInput.readInt();
    }