आपके पास, म्यूटेबल या नहीं बदले जा सकने वाले ByteBuffer को पास करने का विकल्प है. हालांकि, ByteBuffer पास हो जाने के बाद, डेटा को पूरी सुरक्षा देने के लिए, आपको उसमें मौजूद कॉन्टेंट में बदलाव नहीं करना चाहिए.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-24 (UTC) को अपडेट किया गया."],[],[],null,["# ByteBufferMlImageBuilder\n\npublic class **ByteBufferMlImageBuilder** \nBuilds a [MlImage](/edge/api/tflite/java/com/google/android/odml/image/MlImage) from a [ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html).\n\nYou can pass in either mutable or immutable [ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html). However once [ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html) is passed in, to keep data integrity you shouldn't modify content in it.\n\nUse [ByteBufferExtractor](/edge/api/tflite/java/com/google/android/odml/image/ByteBufferExtractor) to get [ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html) you passed in.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Constructors\n\n|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [ByteBufferMlImageBuilder](/edge/api/tflite/java/com/google/android/odml/image/ByteBufferMlImageBuilder#ByteBufferMlImageBuilder(java.nio.ByteBuffer,%20int,%20int,%20int))([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html) byteBuffer, int width, int height, int imageFormat) Creates the builder with mandatory [ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html) and the represented image. |\n\n### Public Methods\n\n|----------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [MlImage](/edge/api/tflite/java/com/google/android/odml/image/MlImage) | [build](/edge/api/tflite/java/com/google/android/odml/image/ByteBufferMlImageBuilder#build())() Builds an [MlImage](/edge/api/tflite/java/com/google/android/odml/image/MlImage) instance. |\n| [ByteBufferMlImageBuilder](/edge/api/tflite/java/com/google/android/odml/image/ByteBufferMlImageBuilder) | [setRotation](/edge/api/tflite/java/com/google/android/odml/image/ByteBufferMlImageBuilder#setRotation(int))(int rotation) Sets value for [MlImage.getRotation()](/edge/api/tflite/java/com/google/android/odml/image/MlImage#getRotation()). |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |\n| final [Class](https://developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public\n**ByteBufferMlImageBuilder**\n([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html) byteBuffer, int width, int height, int imageFormat)\n\nCreates the builder with mandatory [ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html) and the represented image.\n\nWe will validate the size of the `byteBuffer` with given `width`, `height`\nand `imageFormat`.\n\nAlso calls [setRotation(int)](/edge/api/tflite/java/com/google/android/odml/image/ByteBufferMlImageBuilder#setRotation(int)) to set the optional properties. If not set, the values\nwill be set with default:\n\n- rotation: 0\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| byteBuffer | image data object. |\n| width | the width of the represented image. |\n| height | the height of the represented image. |\n| imageFormat | how the data encode the image. |\n|-------------|--------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [MlImage](/edge/api/tflite/java/com/google/android/odml/image/MlImage)\n**build**\n()\n\nBuilds an [MlImage](/edge/api/tflite/java/com/google/android/odml/image/MlImage) instance. \n\n#### public [ByteBufferMlImageBuilder](/edge/api/tflite/java/com/google/android/odml/image/ByteBufferMlImageBuilder)\n**setRotation**\n(int rotation)\n\nSets value for [MlImage.getRotation()](/edge/api/tflite/java/com/google/android/odml/image/MlImage#getRotation()). \n\n##### Parameters\n\n| rotation | |\n|----------|---|\n\n##### Throws\n\n| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if the rotation value is not 0, 90, 180 or 270. |\n|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------|"]]