jdk/src/java.base/share/classes/sun/misc/CharacterDecoder.java
author martin
Tue, 15 Sep 2015 21:56:04 -0700
changeset 32649 2ee9017c7597
parent 30655 d83f50188ca9
permissions -rw-r--r--
8136583: Core libraries should use blessed modifier order Summary: Run blessed-modifier-order script (see bug) Reviewed-by: psandoz, chegar, alanb, plevart
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21278
diff changeset
     2
 * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.misc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.OutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.ByteArrayOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.PushbackInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.io.ByteArrayInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.nio.ByteBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * This class defines the decoding half of character encoders.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * A character decoder is an algorithim for transforming 8 bit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * binary data that has been encoded into text by a character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * encoder, back into original binary form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * The character encoders, in general, have been structured
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * around a central theme that binary data can be encoded into
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * text that has the form:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *      [Buffer Prefix]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *      [Line Prefix][encoded data atoms][Line Suffix]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *      [Buffer Suffix]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * Of course in the simplest encoding schemes, the buffer has no
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * distinct prefix of suffix, however all have some fixed relationship
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * between the text in an 'atom' and the binary data itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * In the CharacterEncoder and CharacterDecoder classes, one complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * chunk of data is referred to as a <i>buffer</i>. Encoded buffers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * are all text, and decoded buffers (sometimes just referred to as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * buffers) are binary octets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * To create a custom decoder, you must, at a minimum,  overide three
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * abstract methods in this class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <DL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * <DD>bytesPerAtom which tells the decoder how many bytes to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * expect from decodeAtom
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * <DD>decodeAtom which decodes the bytes sent to it as text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * <DD>bytesPerLine which tells the encoder the maximum number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * bytes per line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * </DL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * In general, the character decoders return error in the form of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * CEFormatException. The syntax of the detail string is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *      DecoderClassName: Error message.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * Several useful decoders have already been written and are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * referenced in the See Also list below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * @author      Chuck McManis
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * @see         CEFormatException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * @see         CharacterEncoder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * @see         UCDecoder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * @see         UUDecoder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * @see         BASE64Decoder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
public abstract class CharacterDecoder {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    /** Return the number of bytes per atom of decoding */
32649
2ee9017c7597 8136583: Core libraries should use blessed modifier order
martin
parents: 30655
diff changeset
    91
    protected abstract int bytesPerAtom();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /** Return the maximum number of bytes that can be encoded per line */
32649
2ee9017c7597 8136583: Core libraries should use blessed modifier order
martin
parents: 30655
diff changeset
    94
    protected abstract int bytesPerLine();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /** decode the beginning of the buffer, by default this is a NOP. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    protected void decodeBufferPrefix(PushbackInputStream aStream, OutputStream bStream) throws IOException { }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /** decode the buffer suffix, again by default it is a NOP. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    protected void decodeBufferSuffix(PushbackInputStream aStream, OutputStream bStream) throws IOException { }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * This method should return, if it knows, the number of bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * that will be decoded. Many formats such as uuencoding provide
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * this information. By default we return the maximum bytes that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * could have been encoded on the line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    protected int decodeLinePrefix(PushbackInputStream aStream, OutputStream bStream) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        return (bytesPerLine());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * This method post processes the line, if there are error detection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * or correction codes in a line, they are generally processed by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * this method. The simplest version of this method looks for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * (newline) character.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    protected void decodeLineSuffix(PushbackInputStream aStream, OutputStream bStream) throws IOException { }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * This method does an actual decode. It takes the decoded bytes and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * writes them to the OutputStream. The integer <i>l</i> tells the
30655
d83f50188ca9 8080422: some docs cleanup for core libs
avstepan
parents: 25859
diff changeset
   123
     * method how many bytes are required. This is always {@literal <=} bytesPerAtom().
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    protected void decodeAtom(PushbackInputStream aStream, OutputStream bStream, int l) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        throw new CEStreamExhausted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * This method works around the bizarre semantics of BufferedInputStream's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * read method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    protected int readFully(InputStream in, byte buffer[], int offset, int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        throws java.io.IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            int q = in.read();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            if (q == -1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                return ((i == 0) ? -1 : i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            buffer[i+offset] = (byte)q;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return len;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * Decode the text from the InputStream and write the decoded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * octets to the OutputStream. This method runs until the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * is exhausted.
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   148
     * @exception CEFormatException An error has occurred while decoding
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @exception CEStreamExhausted The input stream is unexpectedly out of data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        int     i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        int     totalBytes = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        PushbackInputStream ps = new PushbackInputStream (aStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        decodeBufferPrefix(ps, bStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        while (true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            int length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                length = decodeLinePrefix(ps, bStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                    decodeAtom(ps, bStream, bytesPerAtom());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                    totalBytes += bytesPerAtom();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                if ((i + bytesPerAtom()) == length) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                    decodeAtom(ps, bStream, bytesPerAtom());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                    totalBytes += bytesPerAtom();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                    decodeAtom(ps, bStream, length - i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                    totalBytes += (length - i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                decodeLineSuffix(ps, bStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            } catch (CEStreamExhausted e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        decodeBufferSuffix(ps, bStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Alternate decode interface that takes a String containing the encoded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * buffer and returns a byte array containing the data.
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   184
     * @exception CEFormatException An error has occurred while decoding
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     */
23334
8b590110ed8e 8036848: Fix deprecation warning in sun.misc.CharacterDecoder
bpb
parents: 23010
diff changeset
   186
    public byte[] decodeBuffer(String inputString) throws IOException {
23742
c2b6216ef41d 8039474: sun.misc.CharacterDecoder.decodeBuffer should use getBytes(iso8859-1)
bpb
parents: 23334
diff changeset
   187
        byte inputBuffer[] = inputString.getBytes("ISO-8859-1");
23334
8b590110ed8e 8036848: Fix deprecation warning in sun.misc.CharacterDecoder
bpb
parents: 23010
diff changeset
   188
        ByteArrayInputStream inStream = new ByteArrayInputStream(inputBuffer);
8b590110ed8e 8036848: Fix deprecation warning in sun.misc.CharacterDecoder
bpb
parents: 23010
diff changeset
   189
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        decodeBuffer(inStream, outStream);
23334
8b590110ed8e 8036848: Fix deprecation warning in sun.misc.CharacterDecoder
bpb
parents: 23010
diff changeset
   191
        return outStream.toByteArray();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * Decode the contents of the inputstream into a buffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     */
23334
8b590110ed8e 8036848: Fix deprecation warning in sun.misc.CharacterDecoder
bpb
parents: 23010
diff changeset
   197
    public byte[] decodeBuffer(InputStream in) throws IOException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        decodeBuffer(in, outStream);
23334
8b590110ed8e 8036848: Fix deprecation warning in sun.misc.CharacterDecoder
bpb
parents: 23010
diff changeset
   200
        return outStream.toByteArray();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Decode the contents of the String into a ByteBuffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    public ByteBuffer decodeBufferToByteBuffer(String inputString)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        return ByteBuffer.wrap(decodeBuffer(inputString));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * Decode the contents of the inputStream into a ByteBuffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public ByteBuffer decodeBufferToByteBuffer(InputStream in)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        return ByteBuffer.wrap(decodeBuffer(in));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
}