Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/opengl/ETC1Util#nestedclasses) \| [Ctors](https://developer.android.com/reference/android/opengl/ETC1Util#pubctors) \| [Methods](https://developer.android.com/reference/android/opengl/ETC1Util#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/opengl/ETC1Util#inhmethods)

# ETC1Util

*** ** * ** ***

` public class ETC1Util `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.opengl.ETC1Util |

<br />

*** ** * ** ***

Utility methods for using ETC1 compressed textures.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture` A utility class encapsulating a compressed ETC1 texture. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/opengl/ETC1Util#ETC1Util()() ` |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture` | ` https://developer.android.com/reference/android/opengl/ETC1Util#compressTexture(java.nio.Buffer,%20int,%20int,%20int,%20int)(https://developer.android.com/reference/java/nio/Buffer input, int width, int height, int pixelSize, int stride) ` Helper function that compresses an image into an ETC1Texture. |
| ` static https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture` | ` https://developer.android.com/reference/android/opengl/ETC1Util#createTexture(java.io.InputStream)(https://developer.android.com/reference/java/io/InputStream input) ` Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture. |
| ` static boolean` | ` https://developer.android.com/reference/android/opengl/ETC1Util#isETC1Supported()() ` Check if ETC1 texture compression is supported by the active OpenGL ES context. |
| ` static void` | ` https://developer.android.com/reference/android/opengl/ETC1Util#loadTexture(int,%20int,%20int,%20int,%20int,%20java.io.InputStream)(int target, int level, int border, int fallbackFormat, int fallbackType, https://developer.android.com/reference/java/io/InputStream input) ` Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format. |
| ` static void` | ` https://developer.android.com/reference/android/opengl/ETC1Util#loadTexture(int,%20int,%20int,%20int,%20int,%20android.opengl.ETC1Util.ETC1Texture)(int target, int level, int border, int fallbackFormat, int fallbackType, https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture texture) ` Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format. |
| ` static void` | ` https://developer.android.com/reference/android/opengl/ETC1Util#writeTexture(android.opengl.ETC1Util.ETC1Texture,%20java.io.OutputStream)(https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture texture, https://developer.android.com/reference/java/io/OutputStream output) ` Helper function that writes an ETC1Texture to an output stream formatted as a PKM file. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### ETC1Util

```
public ETC1Util ()
```

<br />

<br />

## Public methods

### compressTexture

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ETC1Util.ETC1Texture compressTexture (Buffer input, 
                int width, 
                int height, 
                int pixelSize, 
                int stride)
```

Helper function that compresses an image into an ETC1Texture.

<br />

| Parameters ||
|---|---|
| `input` | `Buffer`: a native order direct buffer containing the image data <br /> |
| `width` | `int`: the width of the image in pixels <br /> |
| `height` | `int`: the height of the image in pixels <br /> |
| `pixelSize` | `int`: the size of a pixel in bytes (2 or 3) <br /> |
| `stride` | `int`: the width of a line of the image in bytes <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture` | the ETC1 texture. <br /> |

### createTexture

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ETC1Util.ETC1Texture createTexture (InputStream input)
```

Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.

<br />

| Parameters ||
|---|---|
| `input` | `InputStream`: an input stream containing a PKM formatted compressed texture. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture` | an ETC1Texture read from the input stream. <br /> |

| Throws ||
|---|---|
|   | java.io.IOException |
| `https://developer.android.com/reference/java/io/IOException` |   |

### isETC1Supported

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isETC1Supported ()
```

Check if ETC1 texture compression is supported by the active OpenGL ES context.

<br />

| Returns ||
|---|---|
| `boolean` | true if the active OpenGL ES context supports ETC1 texture compression. <br /> |

### loadTexture

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void loadTexture (int target, 
                int level, 
                int border, 
                int fallbackFormat, 
                int fallbackType, 
                InputStream input)
```

Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.

<br />

| Parameters ||
|---|---|
| `target` | `int`: the texture target. <br /> |
| `level` | `int`: the texture level <br /> |
| `border` | `int`: the border size. Typically 0. <br /> |
| `fallbackFormat` | `int`: the format to use if ETC1 texture compression is not supported. Must be GL_RGB. <br /> |
| `fallbackType` | `int`: the type to use if ETC1 texture compression is not supported. Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel, or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel. <br /> |
| `input` | `InputStream`: the input stream containing an ETC1 texture in PKM format. <br /> |

| Throws ||
|---|---|
|   | java.io.IOException |
| `https://developer.android.com/reference/java/io/IOException` |   |

### loadTexture

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void loadTexture (int target, 
                int level, 
                int border, 
                int fallbackFormat, 
                int fallbackType, 
                ETC1Util.ETC1Texture texture)
```

Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.

<br />

| Parameters ||
|---|---|
| `target` | `int`: the texture target. <br /> |
| `level` | `int`: the texture level <br /> |
| `border` | `int`: the border size. Typically 0. <br /> |
| `fallbackFormat` | `int`: the format to use if ETC1 texture compression is not supported. Must be GL_RGB. <br /> |
| `fallbackType` | `int`: the type to use if ETC1 texture compression is not supported. Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel, or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel. <br /> |
| `texture` | `ETC1Util.ETC1Texture`: the ETC1 to load. <br /> |

### writeTexture

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void writeTexture (ETC1Util.ETC1Texture texture, 
                OutputStream output)
```

Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.

<br />

| Parameters ||
|---|---|
| `texture` | `ETC1Util.ETC1Texture`: the input texture. <br /> |
| `output` | `OutputStream`: the stream to write the formatted texture data to. <br /> |

| Throws ||
|---|---|
|   | java.io.IOException |
| `https://developer.android.com/reference/java/io/IOException` |   |