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


Java DataInputStream.readChar方法代码示例

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


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

示例1: loadCachedChangePaths

import java.io.DataInputStream; //导入方法依赖的package包/类
private List<HgLogMessageChangedPath> loadCachedChangePaths (File repository, String revision) {
    Storage storage = StorageManager.getInstance().getStorage(repository.getAbsolutePath());
    byte[] buff = storage.getRevisionInfo(revision);
    if (buff == null) {
        return null;
    }
    List<HgLogMessageChangedPath> changePaths = null;
    DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buff));
    try {
        String version = dis.readUTF();
        if (PERSISTED_DATA_VERSION.equals(version)) {
            int len = dis.readInt();
            changePaths = len == 0 ? null : new ArrayList<HgLogMessageChangedPath>(len); // do not care about empty paths, test for 0
            for (int i = 0; i < len; ++i) {
                String path = dis.readUTF();
                char action = dis.readChar();
                String copyPath = dis.readUTF();
                changePaths.add(new HgLogMessageChangedPath(path, copyPath.isEmpty() ? null : copyPath, action));
            }
        }
    } catch (IOException ex) {
        LOG.log(Level.FINE, "changePaths from disk cache corrupted {0}", new Object[] { revision }); //NOI18N
    }
    return changePaths;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:HistoryRegistry.java

示例2: unserialize

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
* <p>Parses the input stream and stores its trie content into a index and
* data array</p>
* @param inputStream data input stream containing trie data
* @exception IOException thrown when data reading fails
*/
protected final void unserialize(InputStream inputStream)
                                            throws IOException
{
    DataInputStream input = new DataInputStream(inputStream);
    int indexDataLength = m_dataOffset_ + m_dataLength_;
    m_index_ = new char[indexDataLength];
    for (int i = 0; i < indexDataLength; i ++) {
        m_index_[i] = input.readChar();
    }
    m_data_           = m_index_;
    m_initialValue_   = m_data_[m_dataOffset_];
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:CharTrie.java

示例3: unserialize

import java.io.DataInputStream; //导入方法依赖的package包/类
/**
* <p>Parses the inputstream and creates the trie index with it.</p>
* <p>This is overwritten by the child classes.
* @param inputStream input stream containing the trie information
* @exception IOException thrown when data reading fails.
*/
protected void unserialize(InputStream inputStream) throws IOException
{
    //indexLength is a multiple of 1024 >> INDEX_STAGE_2_SHIFT_
    m_index_              = new char[m_dataOffset_];
    DataInputStream input = new DataInputStream(inputStream);
    for (int i = 0; i < m_dataOffset_; i ++) {
         m_index_[i] = input.readChar();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:Trie.java

示例4: read

import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
    value = input.readChar();
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:5,代码来源:CharStorage.java

示例5: GenericWholeArrray

import java.io.DataInputStream; //导入方法依赖的package包/类
public GenericWholeArrray(DataInputStream dis, int stored)
		throws IOException {
	type = dis.readInt();

	switch (type) {
	case TYPE_BYTE:
		byteArray = new byte[stored];
		for (int i = 0; i < stored; i++) {
			byteArray[i] = dis.readByte();
		}
		break;

	case TYPE_SHORT:
		shortArray = new short[stored];
		for (int i = 0; i < stored; i++) {
			shortArray[i] = dis.readShort();
		}
		break;

	case TYPE_INT:
		intArray = new int[stored];
		for (int i = 0; i < stored; i++) {
			intArray[i] = dis.readInt();
		}
		break;

	case TYPE_CHAR:
		charArray = new char[stored];
		for (int i = 0; i < stored; i++) {
			charArray[i] = dis.readChar();
		}
		break;

	case TYPE_BIT:
		int ints = bitsToInts(stored);
		bitArray = new int[ints];
		for (int i = 0; i < ints; i++) {
			bitArray[i] = dis.readInt();
		}
		break;
	}
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:43,代码来源:GenericWholeArrray.java

示例6: readHeader

import java.io.DataInputStream; //导入方法依赖的package包/类
public static final byte[] readHeader(InputStream inputStream,
                                    byte dataFormatIDExpected[],
                                    Authenticate authenticate)
                                                      throws IOException
{
    DataInputStream input = new DataInputStream(inputStream);
    char headersize = input.readChar();
    int readcount = 2;
    //reading the header format
    byte magic1 = input.readByte();
    readcount ++;
    byte magic2 = input.readByte();
    readcount ++;
    if (magic1 != MAGIC1 || magic2 != MAGIC2) {
        throw new IOException(MAGIC_NUMBER_AUTHENTICATION_FAILED_);
    }

    input.readChar(); // reading size
    readcount += 2;
    input.readChar(); // reading reserved word
    readcount += 2;
    byte bigendian    = input.readByte();
    readcount ++;
    byte charset      = input.readByte();
    readcount ++;
    byte charsize     = input.readByte();
    readcount ++;
    input.readByte(); // reading reserved byte
    readcount ++;

    byte dataFormatID[] = new byte[4];
    input.readFully(dataFormatID);
    readcount += 4;
    byte dataVersion[] = new byte[4];
    input.readFully(dataVersion);
    readcount += 4;
    byte unicodeVersion[] = new byte[4];
    input.readFully(unicodeVersion);
    readcount += 4;
    if (headersize < readcount) {
        throw new IOException("Internal Error: Header size error");
    }
    input.skipBytes(headersize - readcount);

    if (bigendian != BIG_ENDIAN_ || charset != CHAR_SET_
        || charsize != CHAR_SIZE_
        || !Arrays.equals(dataFormatIDExpected, dataFormatID)
        || (authenticate != null
            && !authenticate.isDataVersionAcceptable(dataVersion))) {
        throw new IOException(HEADER_AUTHENTICATION_FAILED_);
    }
    return unicodeVersion;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:ICUBinary.java


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