Java Code Examples for java.io.DataInput#readChar()
The following examples show how to use
java.io.DataInput#readChar() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: systemds File: ColGroupDDC2.java License: Apache License 2.0 | 6 votes |
@Override public void readFields(DataInput in) throws IOException { _numRows = in.readInt(); int numCols = in.readInt(); int numVals = in.readInt(); // read col indices _colIndexes = new int[numCols]; for(int i = 0; i < numCols; i++) _colIndexes[i] = in.readInt(); // read distinct values _values = new double[numVals * numCols]; for(int i = 0; i < numVals * numCols; i++) _values[i] = in.readDouble(); // read data _data = new char[_numRows]; for(int i = 0; i < _numRows; i++) _data[i] = in.readChar(); }
Example 2
Source Project: emr-dynamodb-connector File: DynamoDBItemWritable.java License: Apache License 2.0 | 6 votes |
private String readStringFromDataInput(DataInput in) throws IOException { byte[] data; char firstBytes = in.readChar(); if (firstBytes == FIRST_MAGIC_BYTES) { byte nextByte = in.readByte(); if (nextByte == NEXT_MAGIC_BYTE) { // After those three magic bytes the real input begins return readChunks(in); } else { data = new byte[3]; data[0] = (byte) (firstBytes >> 8); data[1] = (byte) firstBytes; data[2] = nextByte; } } else { data = new byte[firstBytes + 2]; data[0] = (byte) (firstBytes >> 8); data[1] = (byte) firstBytes; in.readFully(data, 2, firstBytes); } // In case the read bytes are not from the new input format, back up and // return the result readUTF would have returned return new DataInputStream(new ByteArrayInputStream(data)).readUTF(); }
Example 3
Source Project: gemfirexd-oss File: DataSerializer.java License: Apache License 2.0 | 6 votes |
/** * Reads an array of <code>char</code>s from a * <code>DataInput</code>. * * @throws IOException * A problem occurs while reading from <code>in</code> * * @see #writeCharArray * @since 5.7 */ public static char[] readCharArray(DataInput in) throws IOException { InternalDataSerializer.checkIn(in); int length = InternalDataSerializer.readArrayLength(in); if (length == -1) { return null; } else { char[] array = new char[length]; for (int i = 0; i < length; i++) { array[i] = in.readChar(); } if (DEBUG) { InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Read char array of length " + length); } return array; } }
Example 4
Source Project: systemds File: ColGroupDDC2.java License: Apache License 2.0 | 6 votes |
@Override public void readFields(DataInput in) throws IOException { _numRows = in.readInt(); int numCols = in.readInt(); int numVals = in.readInt(); // read col indices _colIndexes = new int[numCols]; for(int i = 0; i < numCols; i++) _colIndexes[i] = in.readInt(); // read distinct values double[] values = new double[numVals * numCols]; for(int i = 0; i < numVals * numCols; i++) values[i] = in.readDouble(); _dict = new Dictionary(values); // read data _data = new char[_numRows]; for(int i = 0; i < _numRows; i++) _data[i] = in.readChar(); }
Example 5
Source Project: util File: CharArraySerializer.java License: Apache License 2.0 | 5 votes |
@Override public char[] read(DataInput in) throws IOException { final int length = lengthSerializer.read(in); final char[] values = new char[length]; for (int i = 0; i < values.length; i++) { values[i] = in.readChar(); } return values; }
Example 6
Source Project: btree4j File: IOUtils.java License: Apache License 2.0 | 5 votes |
@Nullable public static String readString(@Nonnull final DataInput in) throws IOException { final int len = in.readInt(); if (len == -1) { return null; } final char[] ch = new char[len]; for (int i = 0; i < len; i++) { ch[i] = in.readChar(); } return new String(ch); }
Example 7
Source Project: gemfirexd-oss File: DataSerializer.java License: Apache License 2.0 | 5 votes |
/** * Reads a primitive <code>char</code> from a * <code>DataInput</code>. * * @throws IOException * A problem occurs while reading from <code>in</code> * @see DataInput#readChar * @since 5.1 */ public static char readPrimitiveChar(DataInput in) throws IOException { InternalDataSerializer.checkIn(in); char value = in.readChar(); if (DEBUG) { InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Read Char " + value); } return value; }
Example 8
Source Project: lucene-solr File: Row.java License: Apache License 2.0 | 5 votes |
/** * Construct a Row object from input carried in via the given input stream. * * @param is the input stream * @exception IOException if an I/O error occurs */ public Row(DataInput is) throws IOException { for (int i = is.readInt(); i > 0; i--) { char ch = is.readChar(); Cell c = new Cell(); c.cmd = is.readInt(); c.cnt = is.readInt(); c.ref = is.readInt(); c.skip = is.readInt(); cells.put(ch, c); } }
Example 9
Source Project: incubator-hivemall File: IOUtils.java License: Apache License 2.0 | 5 votes |
@Nullable public static String readString(@Nonnull final DataInput in) throws IOException { final int len = in.readInt(); if (len == -1) { return null; } final char[] ch = new char[len]; for (int i = 0; i < len; i++) { ch[i] = in.readChar(); } return new String(ch); }
Example 10
Source Project: gemfirexd-oss File: DataSerializer.java License: Apache License 2.0 | 5 votes |
/** * Reads a primitive <code>char</code> from a * <code>DataInput</code>. * * @throws IOException * A problem occurs while reading from <code>in</code> * @see DataInput#readChar * @since 5.1 */ public static char readPrimitiveChar(DataInput in) throws IOException { InternalDataSerializer.checkIn(in); char value = in.readChar(); if (DEBUG) { InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Read Char " + value); } return value; }
Example 11
Source Project: evosql File: ResultLob.java License: Apache License 2.0 | 4 votes |
public static ResultLob newLob(DataInput dataInput, boolean readTerminate) throws IOException { ResultLob result = new ResultLob(); result.databaseID = dataInput.readInt(); result.sessionID = dataInput.readLong(); result.lobID = dataInput.readLong(); result.subType = dataInput.readInt(); switch (result.subType) { case LobResultTypes.REQUEST_CREATE_BYTES : case LobResultTypes.REQUEST_CREATE_CHARS : result.blockOffset = dataInput.readLong(); result.blockLength = dataInput.readLong(); break; case LobResultTypes.REQUEST_GET_LOB : case LobResultTypes.REQUEST_DUPLICATE_LOB : // case LobResultTypes.REQUEST_GET_BYTES : case LobResultTypes.REQUEST_GET_CHARS : result.blockOffset = dataInput.readLong(); result.blockLength = dataInput.readLong(); break; case LobResultTypes.REQUEST_SET_BYTES : case LobResultTypes.REQUEST_GET_BYTE_PATTERN_POSITION : result.blockOffset = dataInput.readLong(); result.blockLength = dataInput.readLong(); result.byteBlock = new byte[(int) result.blockLength]; dataInput.readFully(result.byteBlock); break; case LobResultTypes.REQUEST_SET_CHARS : case LobResultTypes.REQUEST_GET_CHAR_PATTERN_POSITION : result.blockOffset = dataInput.readLong(); result.blockLength = dataInput.readLong(); result.charBlock = new char[(int) result.blockLength]; for (int i = 0; i < result.charBlock.length; i++) { result.charBlock[i] = dataInput.readChar(); } break; case LobResultTypes.REQUEST_GET_LENGTH : case LobResultTypes.REQUEST_TRUNCATE : result.blockOffset = dataInput.readLong(); break; case LobResultTypes.RESPONSE_GET_BYTES : result.blockOffset = dataInput.readLong(); result.blockLength = dataInput.readLong(); result.byteBlock = new byte[(int) result.blockLength]; dataInput.readFully(result.byteBlock); break; case LobResultTypes.RESPONSE_GET_CHARS : result.blockOffset = dataInput.readLong(); result.blockLength = dataInput.readLong(); result.charBlock = new char[(int) result.blockLength]; for (int i = 0; i < result.charBlock.length; i++) { result.charBlock[i] = dataInput.readChar(); } break; case LobResultTypes.RESPONSE_SET : case LobResultTypes.RESPONSE_CREATE_BYTES : case LobResultTypes.RESPONSE_CREATE_CHARS : case LobResultTypes.RESPONSE_TRUNCATE : result.blockLength = dataInput.readLong(); break; case LobResultTypes.RESPONSE_GET_BYTE_PATTERN_POSITION : case LobResultTypes.RESPONSE_GET_CHAR_PATTERN_POSITION : result.blockOffset = dataInput.readLong(); break; default : throw Error.runtimeError(ErrorCode.U_S0500, "ResultLob"); } if (readTerminate) { dataInput.readByte(); } return result; }
Example 12
Source Project: hadoop File: SummationWritable.java License: Apache License 2.0 | 4 votes |
/** Read ArithmeticProgression from DataInput */ private static ArithmeticProgression read(DataInput in) throws IOException { return new ArithmeticProgression(in.readChar(), in.readLong(), in.readLong(), in.readLong()); }
Example 13
Source Project: hadoop File: ArrayPrimitiveWritable.java License: Apache License 2.0 | 4 votes |
private void readCharArray(DataInput in) throws IOException { char[] v = (char[]) value; for (int i = 0; i < length; i++) v[i] = in.readChar(); }
Example 14
Source Project: gemfirexd-oss File: MapLiteSerializer.java License: Apache License 2.0 | 4 votes |
public static Character readCharacter(DataInput input) throws IOException { return input.readChar(); }
Example 15
Source Project: stratosphere File: CharType.java License: Apache License 2.0 | 4 votes |
@Override public void read(DataInput in) throws IOException { this.value = in.readChar(); }
Example 16
Source Project: big-c File: SummationWritable.java License: Apache License 2.0 | 4 votes |
/** Read ArithmeticProgression from DataInput */ private static ArithmeticProgression read(DataInput in) throws IOException { return new ArithmeticProgression(in.readChar(), in.readLong(), in.readLong(), in.readLong()); }
Example 17
Source Project: big-c File: ArrayPrimitiveWritable.java License: Apache License 2.0 | 4 votes |
private void readCharArray(DataInput in) throws IOException { char[] v = (char[]) value; for (int i = 0; i < length; i++) v[i] = in.readChar(); }
Example 18
Source Project: gemfirexd-oss File: MapLiteSerializer.java License: Apache License 2.0 | 4 votes |
public static Character readCharacter(DataInput input) throws IOException { return input.readChar(); }
Example 19
Source Project: util File: CharSerializer.java License: Apache License 2.0 | 4 votes |
@Override public Character read(final DataInput in) throws IOException { return in.readChar(); }
Example 20
Source Project: stratosphere File: CharValue.java License: Apache License 2.0 | 4 votes |
@Override public void read(DataInput in) throws IOException { this.value = in.readChar(); }