Java 8 ObjectInputStream.GetField - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ObjectInputStream.GetField class.

This code example shows how to use the following methods:get
     * @throws IOException 
     * @throws ClassNotFoundException 
     */ 
    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
        GetField getField = ois.readFields();
        sourceURI = (String) getField.get("sourceURI", null);
        startLine = (Integer) getField.get("startLine", 0);
        endLine = (Integer) getField.get("endLine", 0);
        extensibilityElements = (HashMap<QName, Object>) getField.get("extensibilityElements", null);
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:get
 
    private URN _hash;
 
    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        GetField gets = stream.readFields();
        _hash = (URN) gets.get("_hash", null);
        _name = (String) gets.get("_name", null);
        _incompleteFile = (File) gets.get("_incompleteFile", null);
 
        // try to read the long size first, if not there read the int 
        _size64 = gets.get("_size64", -1L);
        if (_size64 == -1L)
            _size64 = gets.get("_size", 0);
    } 
     
    /* (non-Javadoc) 
     * @see com.limegroup.gnutella.downloader.serial.conversion.SerialResumeDownloader#getIncompleteFile() 
     */ 
    public File getIncompleteFile() {
        return _incompleteFile;
6
CodeRank
This code example shows how to use the following methods:defaulted, get
     */ 
    @SuppressWarnings("unchecked") 
    private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOException
    { 
        GetField fields = is.readFields();
        if (fields.defaulted("first"))
        { 
            // This is a pre-V3.3 
            this.first = (F) fields.get("fFirst", null);
            this.second = (S) fields.get("fSecond", null);
        } 
        else 
        { 
            this.first = (F) fields.get("first", null);
            this.second = (S) fields.get("second", null);
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:get
     * @throws IOException 
     * @throws ClassNotFoundException 
     */ 
    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
        GetField getField = ois.readFields();
        sourceURI = (String) getField.get("sourceURI", null);
        startLine = (Integer) getField.get("startLine", 0);
        endLine = (Integer) getField.get("endLine", 0);
        extensibilityElements = (HashMap<QName, Object>) getField.get("extensibilityElements", null);
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:get
 
    private URN _hash;
 
    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        GetField gets = stream.readFields();
        _hash = (URN) gets.get("_hash", null);
        _name = (String) gets.get("_name", null);
        _incompleteFile = (File) gets.get("_incompleteFile", null);
 
        // try to read the long size first, if not there read the int 
        _size64 = gets.get("_size64", -1L);
        if (_size64 == -1L)
            _size64 = gets.get("_size", 0);
    } 
     
    /* (non-Javadoc) 
     * @see com.limegroup.gnutella.downloader.serial.conversion.SerialResumeDownloader#getIncompleteFile() 
     */ 
    public File getIncompleteFile() {
        return _incompleteFile;
6
CodeRank
This code example shows how to use the following methods:get
     
 
    private synchronized void readObject(ObjectInputStream stream) throws IOException,
            ClassNotFoundException {
        GetField gets = stream.readFields();
        try { _textQuery = (String)gets.get("_textQuery", null); } catch(IllegalArgumentException iae) {}
        try {_urn = (URN) gets.get("_urn", null);} catch(IllegalArgumentException iae) {}
        try { _filename = (String) gets.get("_filename", null);} catch(IllegalArgumentException iae) {}
        try { _defaultURLs = (String[]) gets.get("_defaultURLs", null);} catch(IllegalArgumentException iae) {}
    } 
} 
6
CodeRank
This code example shows how to use the following methods:defaulted, get
     */ 
    @SuppressWarnings("unchecked") 
    private void readObject(ObjectInputStream is) throws ClassNotFoundException, IOExceptionGetField fields = is.readFields();
        if (fields.defaulted("first"))
        { 
            // This is a pre-V3.3 
            this.first = (F) fields.get("fFirst", null);
            this.second = (S) fields.get("fSecond", null);
        } 
        else 
        { 
            this.first = (F) fields.get("first", null);
            this.second = (S) fields.get("second", null);
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:get
     
 
    private synchronized void readObject(ObjectInputStream stream) throws IOException,
            ClassNotFoundException { 
        GetField gets = stream.readFields();
        try { _textQuery = (String)gets.get("_textQuery", null); } catch(IllegalArgumentException iae) {}
        try {_urn = (URN) gets.get("_urn", null);} catch(IllegalArgumentException iae) {}
        try { _filename = (String) gets.get("_filename", null);} catch(IllegalArgumentException iae) {}
        try { _defaultURLs = (String[]) gets.get("_defaultURLs", null);} catch(IllegalArgumentException iae) {}
    } 
} 
5
CodeRank
This code example shows how to use the following methods:get
    private void writeObject(ObjectOutputStream out) throws IOException {}
     
    @SuppressWarnings("unchecked") 
    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        GetField gets = stream.readFields();
        blocks = (Map<File, List<Range>>) gets.get("blocks", null);
        hashes = (Map<URN, File>) gets.get("hashes", null);
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:get
        return name.apply((ObjectName)notification.getSource()) && (filter == null || filter.isNotificationEnabled(notification));
    } 
 
    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        GetField fields = stream.readFields();
        listenerId = fields.get("listenerId", 0);
        NotificationInfo notificationInfo = (NotificationInfo)fields.get("info", null);
        name = notificationInfo.getName();
        filter = notificationInfo.getFilter();
    } 
 
    private void writeObject(ObjectOutputStream stream) throws IOException {
        PutField fields = stream.putFields();
        fields.put("listenerId", listenerId);
        fields.put("info", new NotificationInfo(name, filter));
        stream.writeFields();
    } 
     
    // Instances of this class are used in HashSets. Therefore we should ensure that the hashCode 
    // is computed exactly as by the original class. Note that since we generate a unique listenerId, 
4
CodeRank
See Code Examples for Java 8 ObjectInputStream.GetField Methods: