Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Apache ZooKeeper Jute Source Code
Apache ZooKeeper is an open-source server which enables highly reliable distributed coordination.
Apache ZooKeeper Jute Source Code files are provided in the source package file, apache-zookeeper-3.8.0.tar.gz.
You can download apache-zookeeper-3.8.0.tar.gz as described in the previous tutorial and go to the "zookeeper-jute" sub-folder to view Apache ZooKeeper Jute Source Code files.
You can also browse Apache ZooKeeper Jute Source Code below:
✍: FYIcenter.com
⏎ org/apache/jute/BinaryInputArchive.java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jute; import java.io.DataInput; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; /** * */ public class BinaryInputArchive implements InputArchive { public static final String UNREASONBLE_LENGTH = "Unreasonable length = "; // CHECKSTYLE.OFF: ConstantName - for backward compatibility public static final int maxBuffer = Integer.getInteger("jute.maxbuffer", 0xfffff); // CHECKSTYLE.ON: private static final int extraMaxBuffer; static { final Integer configuredExtraMaxBuffer = Integer.getInteger("zookeeper.jute.maxbuffer.extrasize", maxBuffer); if (configuredExtraMaxBuffer < 1024) { // Earlier hard coded value was 1024, So the value should not be less than that value extraMaxBuffer = 1024; } else { extraMaxBuffer = configuredExtraMaxBuffer; } } private DataInput in; private int maxBufferSize; private int extraMaxBufferSize; public static BinaryInputArchive getArchive(InputStream strm) { return new BinaryInputArchive(new DataInputStream(strm)); } private static class BinaryIndex implements Index { private int nelems; BinaryIndex(int nelems) { this.nelems = nelems; } public boolean done() { return (nelems <= 0); } public void incr() { nelems--; } } /** * Creates a new instance of BinaryInputArchive. */ public BinaryInputArchive(DataInput in) { this(in, maxBuffer, extraMaxBuffer); } public BinaryInputArchive(DataInput in, int maxBufferSize, int extraMaxBufferSize) { this.in = in; this.maxBufferSize = maxBufferSize; this.extraMaxBufferSize = extraMaxBufferSize; } public byte readByte(String tag) throws IOException { return in.readByte(); } public boolean readBool(String tag) throws IOException { return in.readBoolean(); } public int readInt(String tag) throws IOException { return in.readInt(); } public long readLong(String tag) throws IOException { return in.readLong(); } public float readFloat(String tag) throws IOException { return in.readFloat(); } public double readDouble(String tag) throws IOException { return in.readDouble(); } public String readString(String tag) throws IOException { int len = in.readInt(); if (len == -1) { return null; } checkLength(len); byte[] b = new byte[len]; in.readFully(b); return new String(b, StandardCharsets.UTF_8); } public byte[] readBuffer(String tag) throws IOException { int len = readInt(tag); if (len == -1) { return null; } checkLength(len); byte[] arr = new byte[len]; in.readFully(arr); return arr; } public void readRecord(Record r, String tag) throws IOException { r.deserialize(this, tag); } public void startRecord(String tag) throws IOException { } public void endRecord(String tag) throws IOException { } public Index startVector(String tag) throws IOException { int len = readInt(tag); if (len == -1) { return null; } return new BinaryIndex(len); } public void endVector(String tag) throws IOException { } public Index startMap(String tag) throws IOException { return new BinaryIndex(readInt(tag)); } public void endMap(String tag) throws IOException { } // Since this is a rough sanity check, add some padding to maxBuffer to // make up for extra fields, etc. (otherwise e.g. clients may be able to // write buffers larger than we can read from disk!) private void checkLength(int len) throws IOException { if (len < 0 || len > maxBufferSize + extraMaxBufferSize) { throw new IOException(UNREASONBLE_LENGTH + len); } } }
⏎ org/apache/jute/BinaryInputArchive.java
Or download all of them as a single archive file:
File name: zookeeper-jute-3.8.0-fyi.zip File size: 52965 bytes Release date: 2022-02-25 Download
⇒ Apache ZooKeeper IT Source Code
⇐ Apache ZooKeeper Server Source Code
2022-02-04, 5162👍, 0💬
Popular Posts:
Apache Log4j provides the interface that applications should code to and provides the adapter compon...
What is the sax\Writer.java provided in the Apache Xerces package? I have Apache Xerces 2.11.0 insta...
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
What Is javax.websocket-api-1.1. jar?javax.websocket-api-1.1. jaris the JAR file for Java API for We...
JDOM provides a solution for using XML from Java that is as simple as Java itself. There is no compe...