APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.awt.datatransfer

public abstract Class DataTransferer

extends Object
Class Inheritance
Known Direct Subclasses
sun.awt.X11.XDataTransferer
Imports
java.awt.EventQueue, .Graphics, .Image, .Toolkit, java.awt.datatransfer.DataFlavor, .FlavorMap, .FlavorTable, .Transferable, .UnsupportedFlavorException, java.awt.image.BufferedImage, .ColorModel, .ImageObserver, .RenderedImage, .WritableRaster, java.io.BufferedReader, .ByteArrayInputStream, .ByteArrayOutputStream, .File, .IOException, .InputStream, .InputStreamReader, .ObjectInputStream, .ObjectOutputStream, .Reader, .SequenceInputStream, .StringReader, java.lang.reflect.Constructor, .Modifier, java.net.URI, .URISyntaxException, java.nio.ByteBuffer, .CharBuffer, java.nio.charset.Charset, .CharsetEncoder, .IllegalCharsetNameException, .UnsupportedCharsetException, java.util.AbstractMap, .ArrayList, .Arrays, .Collections, .Comparator, .HashMap, .HashSet, .Iterator, .LinkedHashSet, .List, .Map, .Set, .SortedMap, .Stack, .TreeMap, java.util.stream.Stream, javax.imageio.ImageIO, .ImageReadParam, .ImageReader, .ImageTypeSpecifier, .ImageWriter, javax.imageio.spi.ImageWriterSpi, javax.imageio.stream.ImageInputStream, .ImageOutputStream, sun.awt.ComponentFactory, .SunToolkit, sun.awt.image.ImageRepresentation, .ToolkitImage, sun.datatransfer.DataFlavorUtil

Provides a set of functions to be shared among the DataFlavor class and platform-specific data transfer implementations. The concept of "flavors" and "natives" is extended to include "formats", which are the numeric values Win32 and X11 use to express particular data types. Like FlavorMap, which provides getNativesForFlavors(DataFlavor[]) and getFlavorsForNatives(String[]) functions, DataTransferer provides a set of getFormatsFor(Transferable|Flavor|Flavors) and getFlavorsFor(Format|Formats) functions. Also provided are functions for translating a Transferable into a byte array, given a source DataFlavor and a target format, and for translating a byte array or InputStream into an Object, given a source format and a target DataFlavor.
Authors
David Mendenhall, Danila Sinopalnikov
Since
1.3.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
DataTransferer.ReencodingInputStream

Used for decoding and reencoding an InputStream on demand so that we can strip NUL terminators and perform EOLN search-and-replace.

Field Summary

Modifier and TypeField and Description
private static volatile Runnable
dataConverterInstance

The Runnable for pending data conversion requests.

public static final DataFlavor
javaTextEncodingFlavor

The DataFlavor representing a Java text encoding String encoded in UTF-8, where

    representationClass = [B
    mimeType            = "application/x-java-text-encoding"
private static final Map<Long, String>
nativeCharsets

The native encodings/charsets for the Set of textNatives.

private static final Map<Long, String>
nativeEOLNs

The end-of-line markers for the Set of textNatives.

private static final Map<Long, Integer>
nativeTerminators

The number of terminating NUL bytes for the Set of textNatives.

private static final Set<Long>
textNatives

A collection of all natives listed in flavormap.properties with a primary MIME type of "text".

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static FlavorTable
adaptFlavorMap(final FlavorMap map)

Converts a FlavorMap to a FlavorTable.

private File
castToFile(Object fileObject)

private ArrayList<String>
castToFiles(final List<?> files)

private Object

Returns:

a byte array or an InputStream which represents a logical concatenation of the two arguments.
concatData
(Object
the first object to be concatenated.
obj1
,
Object
the second object to be concatenated.
obj2
)

Concatenates the data represented by two objects.

private Object
constructFlavoredObject(Object arg, DataFlavor flavor, Class<?> clazz)

We support representations which are exactly of the specified Class, and also arbitrary Objects which have a constructor which takes an instance of the Class as its sole parameter.

public byte[]
convertData(final Object source, final Transferable contents, final long format, final Map<Long, DataFlavor> formatMap, final boolean isToolkitThread)

protected abstract ByteArrayOutputStream
private static byte[]
protected abstract String[]
dragQueryFile(byte[] bytes)

Decodes a byte array into a set of String filenames.

protected URI[]
dragQueryURIs(InputStream stream, long format, Transferable localeTransferable)

Decodes URIs from either a byte array or a stream.

protected String
getBestCharsetForTextFormat(Long lFormat, Transferable localeTransferable)

protected String
public abstract String
getDefaultUnicodeEncoding()

Returns the default Unicode encoding for the platform.

public Map<DataFlavor, Long>
getFlavorsForFormats(long[] formats, FlavorTable map)

Returns a Map whose keys are all of the possible DataFlavors into which data in the specified formats can be translated.

public DataFlavor[]
getFlavorsForFormatsAsArray(long[]
the data formats
formats
,
FlavorTable
the FlavorTable which contains mappings between DataFlavors and data formats
map
)

Returns an array of all DataFlavors for which 1) a mapping from at least one of the specified formats exists in the specified map and 2) the data translation for this mapping can be performed by the data transfer subsystem.

public Set<DataFlavor>
getFlavorsForFormatsAsSet(long[]
the data formats
formats
,
FlavorTable
the FlavorTable which contains mappings between DataFlavors and data formats
map
)

Returns a Set of all DataFlavors for which 1) a mapping from at least one of the specified formats exists in the specified map and 2) the data translation for this mapping can be performed by the data transfer subsystem.

protected abstract Long
getFormatForNativeAsLong(String str)

Looks-up or registers the String native with the native data transfer system and returns a long format corresponding to that native.

public SortedMap<Long, DataFlavor>
getFormatsForFlavors(DataFlavor[]
the data flavors
flavors
,
FlavorTable
the FlavorTable which contains mappings between DataFlavors and data formats
map
)

Returns a Map whose keys are all of the possible formats into which data in the specified DataFlavors can be translated.

public SortedMap<Long, DataFlavor>
getFormatsForTransferable(Transferable contents, FlavorTable map)

Returns a Map whose keys are all of the possible formats into which the Transferable's transfer data flavors can be translated.

public long[]
getFormatsForTransferableAsArray(Transferable contents, FlavorTable map)

Reduces the Map output for the root function to an array of the Map's keys.

public static synchronized DataTransferer
getInstance()

The accessor method for the singleton DataTransferer instance.

protected abstract String
getNativeForFormat(long format)

Looks-up the String native corresponding to the specified long format in the native data transfer system.

public LinkedHashSet<String>
getPlatformMappingsForFlavor(DataFlavor df)

Returns platform-specific mappings for the specified flavor.

public LinkedHashSet<DataFlavor>
getPlatformMappingsForNative(String nat)

Returns platform-specific mappings for the specified native.

public abstract ToolkitThreadBlockedHandler
protected abstract byte[]
imageToPlatformBytes(Image image, long format)

Translates a Java Image into a byte array which contains platform- specific image data in the given format.

protected byte[]
imageToStandardBytes(Image image, String
image MIME type, such as: image/png, image/jpeg
mimeType
)

Translates a Java Image into a byte array which contains an image data in the given standard format.

pack-priv byte[]
protected static byte[]
inputStreamToByteArray(InputStream str)

Helper function to convert an InputStream to a byte[] array.

public abstract boolean
isFileFormat(long format)

Determines whether the DataFlavor corresponding to the specified long format is DataFlavor.javaFileListFlavor.

public abstract boolean
isImageFormat(long format)

Determines whether the DataFlavor corresponding to the specified long format is DataFlavor.imageFlavor.

public abstract boolean
isLocaleDependentTextFormat(long format)

Specifies whether text imported from the native system in the specified format is locale-dependent.

protected boolean
isTextFormat(long format)

Determines whether the native corresponding to the specified long format was listed in the flavormap.properties file.

protected boolean
isURIListFormat(long format)

Determines whether the format is a URI list we can convert to a DataFlavor.javaFileListFlavor.

public static long[]
keysToLongArray(SortedMap<Long, ?> map)

Helper function to reduce a Map with Long keys to a long array.

protected abstract Image
platformImageBytesToImage(byte[] bytes, long format)

Translates either a byte array or an input stream which contain platform-specific image data in the given format into an Image.

public void
public void
registerTextFlavorProperties(String nat, String charset, String eoln, String terminators)

This method is called for text flavor mappings established while parsing the flavormap.properties file.

public static DataFlavor[]
setToSortedDataFlavorArray(Set<DataFlavor> flavorsSet)

Helper function to convert a Set of DataFlavors to a sorted array.

protected Image
standardImageBytesToImage(byte[] bytes, String
image MIME type, such as: image/png, image/jpeg, image/gif
mimeType
)

Translates either a byte array or an input stream which contain an image data in the given standard format into an Image.

public Object
translateBytes(byte[] bytes, DataFlavor flavor, long format, Transferable localeTransferable)

private String
translateBytesToString(byte[] bytes, long format, Transferable localeTransferable)

Translating either a byte array or an InputStream into an String.

public Object
translateStream(InputStream str, DataFlavor flavor, long format, Transferable localeTransferable)

Primary translation function for translating an InputStream into an Object, given a source format and a target DataFlavor.

private Object
translateStreamToInputStream(InputStream str, DataFlavor flavor, long format, Transferable localeTransferable)

For arbitrary flavors, just use the raw InputStream.

public byte[]
translateTransferable(Transferable contents, DataFlavor flavor, long format)

Primary translation function for translating a Transferable into a byte array, given a source DataFlavor and target format.

private byte[]
translateTransferableString(String str, long format)

Translation function for converting string into a byte array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataConverterInstanceback to summary
private static volatile Runnable dataConverterInstance

The Runnable for pending data conversion requests.

javaTextEncodingFlavorback to summary
public static final DataFlavor javaTextEncodingFlavor

The DataFlavor representing a Java text encoding String encoded in UTF-8, where

    representationClass = [B
    mimeType            = "application/x-java-text-encoding"
nativeCharsetsback to summary
private static final Map<Long, String> nativeCharsets

The native encodings/charsets for the Set of textNatives.

nativeEOLNsback to summary
private static final Map<Long, String> nativeEOLNs

The end-of-line markers for the Set of textNatives.

nativeTerminatorsback to summary
private static final Map<Long, Integer> nativeTerminators

The number of terminating NUL bytes for the Set of textNatives.

textNativesback to summary
private static final Set<Long> textNatives

A collection of all natives listed in flavormap.properties with a primary MIME type of "text".

Constructor Detail

DataTransfererback to summary
public DataTransferer()

Method Detail

adaptFlavorMapback to summary
public static FlavorTable adaptFlavorMap(final FlavorMap map)

Converts a FlavorMap to a FlavorTable.

castToFileback to summary
private File castToFile(Object fileObject) throws IOException
castToFilesback to summary
private ArrayList<String> castToFiles(final List<?> files) throws IOException
concatDataback to summary
private Object concatData(Object obj1, Object obj2)

Concatenates the data represented by two objects. Objects can be either byte arrays or instances of InputStream. If both arguments are byte arrays byte array will be returned. Otherwise an InputStream will be returned.

Currently is only called from native code to prepend palette data to platform-specific image data during image transfer on Win32.

Parameters
obj1:Object

the first object to be concatenated.

obj2:Object

the second object to be concatenated.

Returns:Object

a byte array or an InputStream which represents a logical concatenation of the two arguments.

Exceptions
NullPointerException:
is either of the arguments is null
ClassCastException:
is either of the arguments is neither byte array nor an instance of InputStream.
constructFlavoredObjectback to summary
private Object constructFlavoredObject(Object arg, DataFlavor flavor, Class<?> clazz) throws IOException

We support representations which are exactly of the specified Class, and also arbitrary Objects which have a constructor which takes an instance of the Class as its sole parameter.

convertDataback to summary
public byte[] convertData(final Object source, final Transferable contents, final long format, final Map<Long, DataFlavor> formatMap, final boolean isToolkitThread) throws IOException
convertFileListToBytesback to summary
protected abstract ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) throws IOException
convertObjectToBytesback to summary
private static byte[] convertObjectToBytes(Object object) throws IOException
dragQueryFileback to summary
protected abstract String[] dragQueryFile(byte[] bytes)

Decodes a byte array into a set of String filenames.

dragQueryURIsback to summary
protected URI[] dragQueryURIs(InputStream stream, long format, Transferable localeTransferable) throws IOException

Decodes URIs from either a byte array or a stream.

getBestCharsetForTextFormatback to summary
protected String getBestCharsetForTextFormat(Long lFormat, Transferable localeTransferable) throws IOException
getCharsetForTextFormatback to summary
protected String getCharsetForTextFormat(Long lFormat)
getDefaultUnicodeEncodingback to summary
public abstract String getDefaultUnicodeEncoding()

Returns the default Unicode encoding for the platform. The encoding need not be canonical. This method is only used by the archaic function DataFlavor.getTextPlainUnicodeFlavor().

getFlavorsForFormatsback to summary
public Map<DataFlavor, Long> getFlavorsForFormats(long[] formats, FlavorTable map)

Returns a Map whose keys are all of the possible DataFlavors into which data in the specified formats can be translated. The value of each key is the format in which the Clipboard or dropped data should be requested when converting to the DataFlavor.

getFlavorsForFormatsAsArrayback to summary
public DataFlavor[] getFlavorsForFormatsAsArray(long[] formats, FlavorTable map)

Returns an array of all DataFlavors for which 1) a mapping from at least one of the specified formats exists in the specified map and 2) the data translation for this mapping can be performed by the data transfer subsystem. The array will be sorted according to a DataFlavorComparator created with the specified map as an argument.

Parameters
formats:long[]

the data formats

map:FlavorTable

the FlavorTable which contains mappings between DataFlavors and data formats

Exceptions
NullPointerException:
if formats or map is null
getFlavorsForFormatsAsSetback to summary
public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map)

Returns a Set of all DataFlavors for which 1) a mapping from at least one of the specified formats exists in the specified map and 2) the data translation for this mapping can be performed by the data transfer subsystem.

Parameters
formats:long[]

the data formats

map:FlavorTable

the FlavorTable which contains mappings between DataFlavors and data formats

Exceptions
NullPointerException:
if formats or map is null
getFormatForNativeAsLongback to summary
protected abstract Long getFormatForNativeAsLong(String str)

Looks-up or registers the String native with the native data transfer system and returns a long format corresponding to that native.

getFormatsForFlavorsback to summary
public SortedMap<Long, DataFlavor> getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map)

Returns a Map whose keys are all of the possible formats into which data in the specified DataFlavors can be translated. The value of each key is the DataFlavor in which the Transferable's data should be requested when converting to the format.

The map keys are sorted according to the native formats preference order.

Parameters
flavors:DataFlavor[]

the data flavors

map:FlavorTable

the FlavorTable which contains mappings between DataFlavors and data formats

Exceptions
NullPointerException:
if flavors or map is null
getFormatsForTransferableback to summary
public SortedMap<Long, DataFlavor> getFormatsForTransferable(Transferable contents, FlavorTable map)

Returns a Map whose keys are all of the possible formats into which the Transferable's transfer data flavors can be translated. The value of each key is the DataFlavor in which the Transferable's data should be requested when converting to the format.

The map keys are sorted according to the native formats preference order.

getFormatsForTransferableAsArrayback to summary
public long[] getFormatsForTransferableAsArray(Transferable contents, FlavorTable map)

Reduces the Map output for the root function to an array of the Map's keys.

getInstanceback to summary
public static synchronized DataTransferer getInstance()

The accessor method for the singleton DataTransferer instance. Note that in a headless environment, there may be no DataTransferer instance; instead, null will be returned.

getNativeForFormatback to summary
protected abstract String getNativeForFormat(long format)

Looks-up the String native corresponding to the specified long format in the native data transfer system.

getPlatformMappingsForFlavorback to summary
public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df)

Returns platform-specific mappings for the specified flavor. If there are no platform-specific mappings for this flavor, the method returns an empty List.

getPlatformMappingsForNativeback to summary
public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat)

Returns platform-specific mappings for the specified native. If there are no platform-specific mappings for this native, the method returns an empty List.

getToolkitThreadBlockedHandlerback to summary
public abstract ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler()
imageToPlatformBytesback to summary
protected abstract byte[] imageToPlatformBytes(Image image, long format) throws IOException

Translates a Java Image into a byte array which contains platform- specific image data in the given format.

imageToStandardBytesback to summary
protected byte[] imageToStandardBytes(Image image, String mimeType) throws IOException

Translates a Java Image into a byte array which contains an image data in the given standard format.

Parameters
mimeType:String

image MIME type, such as: image/png, image/jpeg

imageToStandardBytesImplback to summary
pack-priv byte[] imageToStandardBytesImpl(RenderedImage renderedImage, String mimeType) throws IOException
inputStreamToByteArrayback to summary
protected static byte[] inputStreamToByteArray(InputStream str) throws IOException

Helper function to convert an InputStream to a byte[] array.

isFileFormatback to summary
public abstract boolean isFileFormat(long format)

Determines whether the DataFlavor corresponding to the specified long format is DataFlavor.javaFileListFlavor.

isImageFormatback to summary
public abstract boolean isImageFormat(long format)

Determines whether the DataFlavor corresponding to the specified long format is DataFlavor.imageFlavor.

isLocaleDependentTextFormatback to summary
public abstract boolean isLocaleDependentTextFormat(long format)

Specifies whether text imported from the native system in the specified format is locale-dependent. If so, when decoding such text, 'nativeCharsets' should be ignored, and instead, the Transferable should be queried for its javaTextEncodingFlavor data for the correct encoding.

isTextFormatback to summary
protected boolean isTextFormat(long format)

Determines whether the native corresponding to the specified long format was listed in the flavormap.properties file.

isURIListFormatback to summary
protected boolean isURIListFormat(long format)

Determines whether the format is a URI list we can convert to a DataFlavor.javaFileListFlavor.

keysToLongArrayback to summary
public static long[] keysToLongArray(SortedMap<Long, ?> map)

Helper function to reduce a Map with Long keys to a long array.

The map keys are sorted according to the native formats preference order.

platformImageBytesToImageback to summary
protected abstract Image platformImageBytesToImage(byte[] bytes, long format) throws IOException

Translates either a byte array or an input stream which contain platform-specific image data in the given format into an Image.

processDataConversionRequestsback to summary
public void processDataConversionRequests()
registerTextFlavorPropertiesback to summary
public void registerTextFlavorProperties(String nat, String charset, String eoln, String terminators)

This method is called for text flavor mappings established while parsing the flavormap.properties file. It stores the "eoln" and "terminators" parameters which are not officially part of the MIME type. They are MIME parameters specific to the flavormap.properties file format.

setToSortedDataFlavorArrayback to summary
public static DataFlavor[] setToSortedDataFlavorArray(Set<DataFlavor> flavorsSet)

Helper function to convert a Set of DataFlavors to a sorted array. The array will be sorted according to DataFlavorComparator.

standardImageBytesToImageback to summary
protected Image standardImageBytesToImage(byte[] bytes, String mimeType) throws IOException

Translates either a byte array or an input stream which contain an image data in the given standard format into an Image.

Parameters
mimeType:String

image MIME type, such as: image/png, image/jpeg, image/gif

translateBytesback to summary
public Object translateBytes(byte[] bytes, DataFlavor flavor, long format, Transferable localeTransferable) throws IOException
translateBytesToStringback to summary
private String translateBytesToString(byte[] bytes, long format, Transferable localeTransferable) throws IOException

Translating either a byte array or an InputStream into an String. Strip terminators and search-and-replace EOLN. Native to Java string conversion

translateStreamback to summary
public Object translateStream(InputStream str, DataFlavor flavor, long format, Transferable localeTransferable) throws IOException

Primary translation function for translating an InputStream into an Object, given a source format and a target DataFlavor.

Annotations
@SuppressWarnings:deprecation
translateStreamToInputStreamback to summary
private Object translateStreamToInputStream(InputStream str, DataFlavor flavor, long format, Transferable localeTransferable) throws IOException

For arbitrary flavors, just use the raw InputStream. For text flavors, ReencodingInputStream will decode and reencode the InputStream on demand so that we can strip terminators and search-and-replace EOLN.

translateTransferableback to summary
public byte[] translateTransferable(Transferable contents, DataFlavor flavor, long format) throws IOException

Primary translation function for translating a Transferable into a byte array, given a source DataFlavor and target format.

Annotations
@SuppressWarnings:deprecation
translateTransferableStringback to summary
private byte[] translateTransferableString(String str, long format) throws IOException

Translation function for converting string into a byte array. Search-and-replace EOLN. Encode into the target format. Append terminating NUL bytes. Java to Native string conversion

sun.awt.datatransfer back to summary

public Class DataTransferer.ReencodingInputStream

extends InputStream
Class Inheritance

Used for decoding and reencoding an InputStream on demand so that we can strip NUL terminators and perform EOLN search-and-replace.

Field Summary

Modifier and TypeField and Description
pack-priv CharsetEncoder
pack-priv char[]
pack-priv boolean
pack-priv final char[]
pack-priv CharBuffer
pack-priv int
pack-priv int
pack-priv int
pack-priv byte[]
pack-priv ByteBuffer
pack-priv BufferedReader

Constructor Summary

AccessConstructor and Description
public
ReencodingInputStream(InputStream bytestream, long format, String targetEncoding, Transferable localeTransferable)

Method Summary

Modifier and TypeMethod and Description
public int
available()

Overrides java.io.InputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected.

public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any system resources associated with the stream.

private boolean
matchCharArray(char[] array, int c)

Checks to see if the next array.length characters in wrapped match array.

public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.

private int
Inherited from java.io.InputStream:
markmarkSupportednullInputStreamreadreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

encoderback to summary
pack-priv CharsetEncoder encoder
eolnback to summary
pack-priv char[] eoln
eosback to summary
pack-priv boolean eos
inback to summary
pack-priv final char[] in
inBufback to summary
pack-priv CharBuffer inBuf
indexback to summary
pack-priv int index
limitback to summary
pack-priv int limit
numTerminatorsback to summary
pack-priv int numTerminators
outback to summary
pack-priv byte[] out
outBufback to summary
pack-priv ByteBuffer outBuf
wrappedback to summary
pack-priv BufferedReader wrapped

Constructor Detail

ReencodingInputStreamback to summary
public ReencodingInputStream(InputStream bytestream, long format, String targetEncoding, Transferable localeTransferable) throws IOException

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.InputStream.available.

Doc from java.io.InputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected. The read might be on the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.

Note that while some implementations of InputStream will return the total number of bytes in the stream, many will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream.

A subclass's implementation of this method may choose to throw an IOException if this input stream has been closed by invoking the close() method.

Exceptions
IOException:
if an I/O error occurs.
closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.InputStream.close.

Closes this input stream and releases any system resources associated with the stream.

Exceptions
IOException:
if an I/O error occurs.
matchCharArrayback to summary
private boolean matchCharArray(char[] array, int c) throws IOException

Checks to see if the next array.length characters in wrapped match array. The first character is provided as c. Subsequent characters are read from wrapped itself. When this method returns, the wrapped index may be different from what it was when this method was called.

readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Exceptions
IOException:
if an I/O error occurs.
readCharback to summary
private int readChar() throws IOException